C++: Demonstrate AmbiguouslySignedBitField FP

This commit is contained in:
Jonas Jensen
2019-09-19 14:19:34 +02:00
parent 6f2e485ace
commit 0ed0951d43
2 changed files with 8 additions and 0 deletions

View File

@@ -3,3 +3,4 @@
| test.cpp:20:8:20:18 | nosignshort | Bit field nosignshort of type short should have explicitly unsigned integral, explicitly signed integral, or enumeration type. |
| test.cpp:21:18:21:30 | nosigntypedef | Bit field nosigntypedef of type int should have explicitly unsigned integral, explicitly signed integral, or enumeration type. |
| test.cpp:23:15:23:25 | nosignconst | Bit field nosignconst of type const int should have explicitly unsigned integral, explicitly signed integral, or enumeration type. |
| test.cpp:31:5:31:16 | templatesign | Bit field templatesign of type T should have explicitly unsigned integral, explicitly signed integral, or enumeration type. |

View File

@@ -25,3 +25,10 @@ struct {
myEnum nosignenum : 2;
const myEnum constnosignenum : 2;
};
template<typename T>
struct TemplateWithBitfield {
T templatesign : 2; // GOOD [FALSE POSITIVE]
};
TemplateWithBitfield<signed int> twb;