aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/init.c
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2012-02-09 03:29:06 +0000
committerAaron Ballman <aaron@aaronballman.com>2012-02-09 03:29:06 +0000
commit0ca7e8bf904d1c2cf70d271f3a06c1d71ff7e4fb (patch)
tree371ad09395b6f69b47c013b0e0df35bbc0c17acd /test/Sema/init.c
parentc6a6369b82db5b51769c4eaa29f8b0199142577a (diff)
Attempting to initialize a union member that does not exist no longer crashes.
Patch by Remi Gacogne git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/init.c')
-rw-r--r--test/Sema/init.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/Sema/init.c b/test/Sema/init.c
index 2527e14fcb..4dcfafa479 100644
--- a/test/Sema/init.c
+++ b/test/Sema/init.c
@@ -18,10 +18,19 @@ extern int x;
void *g = &x;
int *h = &x;
+struct union_crash
+{
+ union
+ {
+ };
+};
+
int test() {
-int a[10];
-int b[10] = a; // expected-error {{array initializer must be an initializer list}}
-int +; // expected-error {{expected identifier or '('}}
+ int a[10];
+ int b[10] = a; // expected-error {{array initializer must be an initializer list}}
+ int +; // expected-error {{expected identifier or '('}}
+
+ struct union_crash u = { .d = 1 }; // expected-error {{field designator 'd' does not refer to any field in type 'struct union_crash'}}
}