Skip to content

Commit 0ed0951

Browse files
committed
C++: Demonstrate AmbiguouslySignedBitField FP
1 parent 6f2e485 commit 0ed0951

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cpp/ql/test/query-tests/Likely Bugs/AmbiguouslySignedBitField/AmbiguouslySignedBitField.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
| test.cpp:20:8:20:18 | nosignshort | Bit field nosignshort of type short should have explicitly unsigned integral, explicitly signed integral, or enumeration type. |
44
| test.cpp:21:18:21:30 | nosigntypedef | Bit field nosigntypedef of type int should have explicitly unsigned integral, explicitly signed integral, or enumeration type. |
55
| 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. |
6+
| test.cpp:31:5:31:16 | templatesign | Bit field templatesign of type T should have explicitly unsigned integral, explicitly signed integral, or enumeration type. |

cpp/ql/test/query-tests/Likely Bugs/AmbiguouslySignedBitField/test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ struct {
2525
myEnum nosignenum : 2;
2626
const myEnum constnosignenum : 2;
2727
};
28+
29+
template<typename T>
30+
struct TemplateWithBitfield {
31+
T templatesign : 2; // GOOD [FALSE POSITIVE]
32+
};
33+
34+
TemplateWithBitfield<signed int> twb;

0 commit comments

Comments
 (0)