1 parent 0b59984 commit 024d4e1Copy full SHA for 024d4e1
1 file changed
test/testtype.cpp
@@ -617,6 +617,13 @@ class TestType : public TestFixture {
617
" i << 2;\n"
618
"}\n", dinit(CheckPOptions, $.settings = &s));
619
ASSERT_EQUALS("[test.cpp:4:7]: (error) Signed integer overflow for expression 'i<<2'. [integerOverflow]\n", errout_str());
620
+
621
+ checkP("void g(int a) {\n" // #13342
622
+ " int b = INT_MAX + a;\n"
623
+ " printf(\"%d\", b); \n"
624
+ "}\n"
625
+ "void f() { g(1); }", dinit(CheckPOptions, $.settings = &s));
626
+ ASSERT_EQUALS("[test.cpp:2:21]: (error) Signed integer overflow for expression '2147483647+a'. [integerOverflow]\n", errout_str());
627
}
628
629
void shiftTooManyBits() { // #11496
0 commit comments