Ticket #8640: Added regression test
This commit is contained in:
parent
0d7a3a8b26
commit
b2d81f0870
|
@ -167,6 +167,17 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #8640
|
||||
check("int f (void)\n"
|
||||
"{\n"
|
||||
" constexpr const int a = 1;\n"
|
||||
" constexpr const int shift[1] = {32};\n"
|
||||
" constexpr const int ret = a << shift[0];\n" // shift too many bits
|
||||
" return ret;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:5]: (error) Shifting 32-bit value by 32 bits is undefined behaviour\n"
|
||||
"[test.cpp:5]: (error) Signed integer overflow for expression 'a<<shift[0]'.\n", errout.str());
|
||||
|
||||
// #8885
|
||||
check("int f(int k, int rm) {\n"
|
||||
" if (k == 32)\n"
|
||||
|
|
Loading…
Reference in New Issue