aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-16 21:23:54 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-16 21:23:54 +0000
commit449d4f06fe7501ed53e3aaaa465a499442285e90 (patch)
treee40f264bf935fb2665c27d1e748f50ee99790b20
parentbdd4c848349d4091d66b052efa453e6d69a77e36 (diff)
Make sure we still reject static data members in anonymous unions in C++11.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150724 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CXX/class/class.union/p2-0x.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CXX/class/class.union/p2-0x.cpp b/test/CXX/class/class.union/p2-0x.cpp
index d353bda27c..b5c410925c 100644
--- a/test/CXX/class/class.union/p2-0x.cpp
+++ b/test/CXX/class/class.union/p2-0x.cpp
@@ -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;
+};