From aeb6b30f64ff48cd4a03e5a928d2824801dde174 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Mon, 28 Jan 2008 02:00:41 +0000 Subject: Fix a bug with struct initializers (in Sema::CheckInitializerListTypes()). Test case included from bz1948 (thanks Neil!). Also fixed an 80 column violation... llvm-svn: 46430 --- clang/test/Sema/array-init.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/test/Sema/array-init.c') diff --git a/clang/test/Sema/array-init.c b/clang/test/Sema/array-init.c index 4b94ed18cd2..cfbc2b926ae 100644 --- a/clang/test/Sema/array-init.c +++ b/clang/test/Sema/array-init.c @@ -190,6 +190,11 @@ struct s2 {struct s1 c;} t2 = { t1 }; struct s1 t3[] = {t1, t1, "abc", 0}; //expected-warning{{incompatible pointer to integer conversion initializing 'char *', expected 'char'}} int t4[sizeof t3 == 6 ? 1 : -1]; } +struct foo { int z; } w; +int bar (void) { + struct foo z = { w }; //expected-error{{incompatible type initializing 'struct foo', expected 'int'}} + return z.z; +} struct s3 {void (*a)(void);} t5 = {autoStructTest}; // GCC extension; flexible array init. Once this is implemented, the warning should be removed. // Note that clang objc implementation depends on this extension. -- cgit v1.2.3