summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX
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
commit4fa6aec9fe5b3ea6571b7455d9d77efc18495d67 (patch)
tree8a0bab4bb090c8138f2f657c7e163625ce1ae284 /clang/test/CXX
parent2eef6b9e4b70f01bb164537688492aaa9506d5f3 (diff)
downloadbcm5719-llvm-4fa6aec9fe5b3ea6571b7455d9d77efc18495d67.tar.gz
bcm5719-llvm-4fa6aec9fe5b3ea6571b7455d9d77efc18495d67.zip
Make sure we still reject static data members in anonymous unions in C++11.
llvm-svn: 150724
Diffstat (limited to 'clang/test/CXX')
-rw-r--r--clang/test/CXX/class/class.union/p2-0x.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/CXX/class/class.union/p2-0x.cpp b/clang/test/CXX/class/class.union/p2-0x.cpp
index d353bda27ce..b5c410925ce 100644
--- a/clang/test/CXX/class/class.union/p2-0x.cpp
+++ b/clang/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;
+};
OpenPOWER on IntegriCloud