]> granicus.if.org Git - clang/commitdiff
Make sure we still reject static data members in anonymous unions in C++11.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 16 Feb 2012 21:23:54 +0000 (21:23 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 16 Feb 2012 21:23:54 +0000 (21:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150724 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/class/class.union/p2-0x.cpp

index d353bda27ce5122bbfa6231b64545cad0fde9404..b5c410925cec77104a4d0bd0d38402035043acf5 100644 (file)
@@ -34,3 +34,15 @@ union U3 {
   static const int k;
   U3() : k(0) {} // expected-error {{does not name a non-static data member}}
 };
+
+struct S {
+  union {
+    static const int n; // expected-error {{static members cannot be declared in an anonymous union}}
+    int a;
+    int b;
+  };
+};
+static union {
+  static const int k; // expected-error {{static members cannot be declared in an anonymous union}}
+  int n;
+};