summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-15 06:41:24 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-15 06:41:24 +0000
commitd5846a1eb5655f0e1ea50d06677fd1686cb01227 (patch)
tree3c56f1ca444f0e19ab068eec3ac4a76e84fef7cc /clang/test
parent3dfaeeaefcfb573a959d5e02c96abff3cc2046ad (diff)
downloadbcm5719-llvm-d5846a1eb5655f0e1ea50d06677fd1686cb01227.tar.gz
bcm5719-llvm-d5846a1eb5655f0e1ea50d06677fd1686cb01227.zip
Implement support for designated initializers that refer to members of
anonymous structs or unions. Fixes PR3778. llvm-svn: 69153
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/designated-initializers.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/Sema/designated-initializers.c b/clang/test/Sema/designated-initializers.c
index f4170c267de..309a5304598 100644
--- a/clang/test/Sema/designated-initializers.c
+++ b/clang/test/Sema/designated-initializers.c
@@ -187,3 +187,37 @@ const union wibble wobble = { .arr2[0] = 0xffff,
.arr2[2] = 0xffff };
const union wibble wobble2 = { .arr2 = {4, 5, 6}, 7 }; // expected-warning{{excess elements in union initializer}}
+
+// PR3778
+struct s {
+ union { int i; };
+};
+struct s si = {
+ { .i = 1 }
+};
+
+double d0;
+char c0;
+float f0;
+int i0;
+
+struct Enigma {
+ union {
+ struct {
+ struct {
+ double *double_ptr;
+ char *string;
+ };
+ float *float_ptr;
+ };
+ int *int_ptr;
+ };
+ char *string2;
+};
+
+struct Enigma enigma = {
+ .double_ptr = &d0, &c0,
+ &f0, // expected-note{{previous}}
+ &c0,
+ .float_ptr = &f0 // expected-warning{{overrides}}
+};
OpenPOWER on IntegriCloud