bad sizeof handling

This commit is contained in:
Daniel Marjamäki 2009-01-28 05:31:26 +00:00
parent b30e78e14c
commit 12b6cf8c70
1 changed files with 17 additions and 0 deletions

View File

@ -68,6 +68,8 @@ private:
TEST_CASE(noerr3); TEST_CASE(noerr3);
TEST_CASE(noerr4); TEST_CASE(noerr4);
TEST_CASE(sizeof1);
TEST_CASE(array_index_1); TEST_CASE(array_index_1);
TEST_CASE(array_index_2); TEST_CASE(array_index_2);
TEST_CASE(array_index_3); TEST_CASE(array_index_3);
@ -157,6 +159,21 @@ private:
} }
void sizeof1()
{
check("static void f()\n"
"{\n"
" char data[10];\n"
" data[ sizeof(*data) ] = 0;\n"
"}\n");
ASSERT_EQUALS(std::string(""), errout.str());
}
void array_index_1() void array_index_1()
{ {
check("void f()\n" check("void f()\n"