Skip to content

Commit 024d4e1

Browse files
Add test for #13342
1 parent 0b59984 commit 024d4e1

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

test/testtype.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,13 @@ class TestType : public TestFixture {
617617
" i << 2;\n"
618618
"}\n", dinit(CheckPOptions, $.settings = &s));
619619
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());
620627
}
621628

622629
void shiftTooManyBits() { // #11496

0 commit comments

Comments
 (0)