[cfe-commits] r150724 - /cfe/trunk/test/CXX/class/class.union/p2-0x.cpp

Richard Smith richard-llvm at metafoo.co.uk
Thu Feb 16 13:23:54 PST 2012


Author: rsmith
Date: Thu Feb 16 15:23:54 2012
New Revision: 150724

URL: http://llvm.org/viewvc/llvm-project?rev=150724&view=rev
Log:
Make sure we still reject static data members in anonymous unions in C++11.

Modified:
    cfe/trunk/test/CXX/class/class.union/p2-0x.cpp

Modified: cfe/trunk/test/CXX/class/class.union/p2-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.union/p2-0x.cpp?rev=150724&r1=150723&r2=150724&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class/class.union/p2-0x.cpp (original)
+++ cfe/trunk/test/CXX/class/class.union/p2-0x.cpp Thu Feb 16 15:23:54 2012
@@ -34,3 +34,15 @@
   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;
+};





More information about the cfe-commits mailing list