Skip to content

Commit c510f58

Browse files
Update testother.cpp
1 parent fb177b1 commit c510f58

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎test/testother.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10603,6 +10603,13 @@ class TestOther : public TestFixture {
1060310603
" return f<-1>(2)\n"
1060410604
"}\n");
1060510605
ASSERT_EQUALS("", errout_str());
10606+
10607+
Settings settings = settingsBuilder(settings0).severity(Severity::portability).build();
10608+
check("int f(int k, int& s) {\n" // #7215
10609+
" if (k >= -128 && k <= 127)\n"
10610+
" s = (k << 8);\n"
10611+
"}\n", dinit(CheckOptions, $.settings = &settings));
10612+
ASSERT_EQUALS("[test.cpp:2:11] -> [test.cpp:3:16]: (portability) Shifting a negative value is technically undefined behaviour [shiftNegativeLHS]\n", errout_str());
1060610613
}
1060710614

1060810615
void checkNegativeShiftErrorPath() {

0 commit comments

Comments
 (0)