This commit is contained in:
Sébastien Debrard 2011-01-23 16:32:33 +01:00
parent 74bc421f4c
commit 86ba9dc908
1 changed files with 33 additions and 0 deletions

View File

@ -84,6 +84,7 @@ private:
TEST_CASE(sizeof19); // #1891 - sizeof 'x' TEST_CASE(sizeof19); // #1891 - sizeof 'x'
TEST_CASE(sizeof20); // #2024 - sizeof a) TEST_CASE(sizeof20); // #2024 - sizeof a)
TEST_CASE(sizeof21); // #2232 - sizeof...(Args) TEST_CASE(sizeof21); // #2232 - sizeof...(Args)
TEST_CASE(sizeof22); // #155
TEST_CASE(sizeofsizeof); TEST_CASE(sizeofsizeof);
TEST_CASE(casting); TEST_CASE(casting);
@ -849,6 +850,7 @@ private:
" sizeof(*i);\n" " sizeof(*i);\n"
"}\n"; "}\n";
ASSERT_EQUALS("void foo ( ) { int i [ 4 ] ; 16 ; 4 ; }", sizeof_(code)); ASSERT_EQUALS("void foo ( ) { int i [ 4 ] ; 16 ; 4 ; }", sizeof_(code));
TODO_ASSERT_EQUALS("void foo ( ) { int i [ 4 ] ; 4 ; 4 ; }", sizeof_(code));
} }
void sizeof3() void sizeof3()
@ -860,6 +862,7 @@ private:
" sizeof(i);\n" " sizeof(i);\n"
"}\n"; "}\n";
ASSERT_EQUALS("static int i [ 4 ] ; void f ( ) { int i [ 10 ] ; 40 ; }", sizeof_(code)); ASSERT_EQUALS("static int i [ 4 ] ; void f ( ) { int i [ 10 ] ; 40 ; }", sizeof_(code));
TODO_ASSERT_EQUALS("static int i [ 4 ] ; void f ( ) { int i [ 10 ] ; 10 ; }", sizeof_(code));
} }
void sizeof4() void sizeof4()
@ -1408,6 +1411,36 @@ private:
tok(code); tok(code);
} }
void sizeof22()
{
{
const char code[] = "void foo(int i[10])\n"
"{\n"
" sizeof(i);\n"
" sizeof(*i);\n"
"}\n";
TODO_ASSERT_EQUALS("void foo ( ) { sizeof ( i ) ; 4 ; }", sizeof_(code));
}
{
const char code[] = "void foo(int i[])\n"
"{\n"
" sizeof(i);\n"
" sizeof(*i);\n"
"}\n";
TODO_ASSERT_EQUALS("void foo ( ) { sizeof ( i ) ; 4 ; }", sizeof_(code));
}
{
const char code[] = "void foo(int i[])\n"
"{\n"
" sizeof i;\n"
" sizeof(*i);\n"
"}\n";
TODO_ASSERT_EQUALS("void foo ( ) { sizeof ( i ) ; 4 ; }", sizeof_(code));
}
}
void sizeofsizeof() void sizeofsizeof()
{ {