diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-02-11 00:02:17 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-02-11 00:02:17 +0000 |
| commit | 36fc8790b7ae08f00b4e8958f2b8371c37031e14 (patch) | |
| tree | 07e23087add768079da175674cf75137c99f8b7b /clang/test/Sema/array-init.c | |
| parent | de4496bb9ef95ef12d7a72582df95cf64772800a (diff) | |
| download | bcm5719-llvm-36fc8790b7ae08f00b4e8958f2b8371c37031e14.tar.gz bcm5719-llvm-36fc8790b7ae08f00b4e8958f2b8371c37031e14.zip | |
Fix PR1992 by computing the right type for string literals, which
is an array type not a pointer type. This requires updating some
diags that change and updating the code generator to handle the
proper form of strings.
llvm-svn: 46941
Diffstat (limited to 'clang/test/Sema/array-init.c')
| -rw-r--r-- | clang/test/Sema/array-init.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/test/Sema/array-init.c b/clang/test/Sema/array-init.c index cfbc2b926ae..849737e49e6 100644 --- a/clang/test/Sema/array-init.c +++ b/clang/test/Sema/array-init.c @@ -9,7 +9,7 @@ int ary2[] = { x, y, z }; // expected-error{{initializer element is not constant extern int fileScopeExtern[3] = { 1, 3, 5 }; // expected-warning{{'extern' variable has an initializer}} -static int ary3[] = { 1, "abc", 3, 4 }; // expected-warning{{incompatible pointer to integer conversion initializing 'char *', expected 'int'}} +static int ary3[] = { 1, "abc", 3, 4 }; // expected-warning{{incompatible pointer to integer conversion initializing 'char [4]', expected 'int'}} void func() { int x = 1; @@ -48,7 +48,7 @@ void func() { extern int blockScopeExtern[3] = { 1, 3, 5 }; // expected-error{{'extern' variable cannot have an initializer}} - static int x2[3] = { 1.0, "abc" , 5.8 }; // expected-warning{{incompatible pointer to integer conversion initializing 'char *', expected 'int'}} + static int x2[3] = { 1.0, "abc" , 5.8 }; // expected-warning{{incompatible pointer to integer conversion initializing 'char [4]', expected 'int'}} } void test() { @@ -152,10 +152,10 @@ void charArrays() char c[] = { "Hello" }; int l[sizeof(c) == 6 ? 1 : -1]; - int i[] = { "Hello "}; // expected-warning{{incompatible pointer to integer conversion initializing 'char *', expected 'int'}} + int i[] = { "Hello "}; // expected-warning{{incompatible pointer to integer conversion initializing 'char [7]', expected 'int'}} char c2[] = { "Hello", "Good bye" }; //expected-error{{excess elements in char array initializer}} - int i2[1] = { "Hello" }; //expected-warning{{incompatible pointer to integer conversion initializing 'char *', expected 'int'}} + int i2[1] = { "Hello" }; //expected-warning{{incompatible pointer to integer conversion initializing 'char [6]', expected 'int'}} char c3[5] = { "Hello" }; char c4[4] = { "Hello" }; //expected-warning{{initializer-string for char array is too long}} @@ -187,7 +187,7 @@ void autoStructTest() { struct s1 {char a; char b;} t1; struct s2 {struct s1 c;} t2 = { t1 }; // The following is a less than great diagnostic (though it's on par with EDG). -struct s1 t3[] = {t1, t1, "abc", 0}; //expected-warning{{incompatible pointer to integer conversion initializing 'char *', expected 'char'}} +struct s1 t3[] = {t1, t1, "abc", 0}; //expected-warning{{incompatible pointer to integer conversion initializing 'char [4]', expected 'char'}} int t4[sizeof t3 == 6 ? 1 : -1]; } struct foo { int z; } w; |

