parent
38de9214a8
commit
e6091cbe54
|
@ -3281,6 +3281,13 @@ private:
|
|||
" g(u\"Hello\" + 7);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (portability) Undefined behaviour, pointer arithmetic 'u\"Hello\"+7' is out of bounds.\n", errout.str());
|
||||
|
||||
check("void f() {\n" // #4647
|
||||
" int val = 5;\n"
|
||||
" std::string hi = \"hi\" + val;\n"
|
||||
" std::cout << hi << std::endl;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (portability) Undefined behaviour, pointer arithmetic '\"hi\"+val' is out of bounds.\n", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -243,6 +243,8 @@ private:
|
|||
TEST_CASE(garbageCode215); // daca@home script with extension .c
|
||||
TEST_CASE(garbageCode216); // #7884
|
||||
TEST_CASE(garbageCode217); // #10011
|
||||
TEST_CASE(garbageCode218); // #8763
|
||||
TEST_CASE(garbageCode219); // #10101
|
||||
|
||||
TEST_CASE(garbageCodeFuzzerClientMode1); // test cases created with the fuzzer client, mode 1
|
||||
|
||||
|
@ -1684,6 +1686,17 @@ private:
|
|||
"}"), InternalError);
|
||||
}
|
||||
|
||||
void garbageCode218() { // #8763
|
||||
checkCode("d f(){t n0000 const[]n0000+0!=n0000,(0)}"); // don't crash
|
||||
}
|
||||
void garbageCode219() { // #10101
|
||||
checkCode("typedef void (*func) (addr) ;\n"
|
||||
"void bar(void) {\n"
|
||||
" func f;\n"
|
||||
" f & = (func)42;\n"
|
||||
"}\n"); // don't crash
|
||||
}
|
||||
|
||||
void syntaxErrorFirstToken() {
|
||||
ASSERT_THROW(checkCode("&operator(){[]};"), InternalError); // #7818
|
||||
ASSERT_THROW(checkCode("*(*const<> (size_t); foo) { } *(*const (size_t)() ; foo) { }"), InternalError); // #6858
|
||||
|
|
|
@ -1204,6 +1204,12 @@ private:
|
|||
"}", true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
check("void f() {\n" // #5979
|
||||
" int* const crash = 0;\n"
|
||||
" *crash = 0;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Null pointer dereference: crash\n", errout.str());
|
||||
}
|
||||
|
||||
// Ticket #2350
|
||||
|
|
Loading…
Reference in New Issue