diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-07-29 14:29:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-07-29 14:29:34 +0000 |
commit | 0333296d142d45bf2723635848928815b7491f91 (patch) | |
tree | 36417d71b97f8c9e437f3762d4a86b0f14e781f0 /test/Sema/array-init.c | |
parent | 021c3a349d4f55cc2c7970268758bcf37b924493 (diff) |
Reword the empty struct/union warning in C to note that such structs and unions have size 0 in C, size 1 in C++. Put this warning under -Wc++-compat.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109748 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/array-init.c')
-rw-r--r-- | test/Sema/array-init.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c index f93b0878fd..c042943516 100644 --- a/test/Sema/array-init.c +++ b/test/Sema/array-init.c @@ -218,7 +218,8 @@ void varArray() { } // PR2151 -void emptyInit() {struct {} x[] = {6};} //expected-warning{{empty struct extension}} expected-error{{initializer for aggregate with no elements}} +void emptyInit() {struct {} x[] = {6};} //expected-warning{{empty struct (accepted as an extension) has size 0 in C, size 1 in C++}} \ +// expected-error{{initializer for aggregate with no elements}} void noNamedInit() { struct {int:5;} x[] = {6}; //expected-error{{initializer for aggregate with no elements}} @@ -241,7 +242,8 @@ struct soft_segment_descriptor gdt_segs[] = { }; static void sppp_ipv6cp_up(); -const struct {} ipcp = { sppp_ipv6cp_up }; //expected-warning{{empty struct extension}} expected-warning{{excess elements in struct initializer}} +const struct {} ipcp = { sppp_ipv6cp_up }; //expected-warning{{empty struct (accepted as an extension) has size 0 in C, size 1 in C++}} \ +// expected-warning{{excess elements in struct initializer}} struct _Matrix { union { float m[4][4]; }; }; //expected-warning{{anonymous unions are a GNU extension in C}} typedef struct _Matrix Matrix; |