diff --git a/test/testtype.cpp b/test/testtype.cpp index e3fa69c7d..f77f5f311 100644 --- a/test/testtype.cpp +++ b/test/testtype.cpp @@ -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<