Diagnose multiple initialization of anonymous union
fields in the ctor-initializer list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74554 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp
index d8b95ce..7fd748b 100644
--- a/test/SemaCXX/constructor-initializer.cpp
+++ b/test/SemaCXX/constructor-initializer.cpp
@@ -66,3 +66,11 @@
Z() : S(), X(), E() {} // expected-error {{type 'class E' is not a direct or virtual base of 'Z'}}
};
+class U {
+ union { int a; char* p; };
+ union { int b; double d; };
+
+ U() : a(1), p(0), d(1.0) {} // expected-error {{multiple initializations given for non-static member 'p'}} \
+ // expected-note {{previous initialization is here}}
+};
+