summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/anonymous-union.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-01-28 00:54:05 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-01-28 00:54:05 +0000
commit254d2666e435e385c4b688dedb2bd4c2f33f0619 (patch)
tree71519b901fc59c1642724026e25e604b26eadf20 /clang/test/SemaCXX/anonymous-union.cpp
parent73fe152cd8a3b45711d27a9c5bc53debc654e453 (diff)
downloadbcm5719-llvm-254d2666e435e385c4b688dedb2bd4c2f33f0619.tar.gz
bcm5719-llvm-254d2666e435e385c4b688dedb2bd4c2f33f0619.zip
Add a -pedantic warning: an anonymous union within an anonymous union is not
permitted in standard C++, despite being silently accepted by many (all?) major C++ implementations. llvm-svn: 173643
Diffstat (limited to 'clang/test/SemaCXX/anonymous-union.cpp')
-rw-r--r--clang/test/SemaCXX/anonymous-union.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/test/SemaCXX/anonymous-union.cpp b/clang/test/SemaCXX/anonymous-union.cpp
index 2dd7ab86a88..e77f5251473 100644
--- a/clang/test/SemaCXX/anonymous-union.cpp
+++ b/clang/test/SemaCXX/anonymous-union.cpp
@@ -9,7 +9,7 @@ struct X {
int i;
float f;
- union {
+ union { // expected-warning{{nested anonymous types are an extension}}
float f2;
mutable double d;
};
@@ -101,7 +101,7 @@ void g() {
struct BadMembers {
union {
struct X { }; // expected-error {{types cannot be declared in an anonymous union}}
- struct { int x; int y; } y;
+ struct { int x; int y; } y; // expected-warning{{nested anonymous types are an extension}}
void f(); // expected-error{{functions cannot be declared in an anonymous union}}
private: int x1; // expected-error{{anonymous union cannot contain a private data member}}
@@ -128,7 +128,7 @@ namespace test4 {
struct { // expected-warning{{anonymous structs are a GNU extension}}
int s0; // expected-note {{declared private here}}
double s1; // expected-note {{declared private here}}
- union {
+ union { // expected-warning{{nested anonymous type}}
int su0; // expected-note {{declared private here}}
double su1; // expected-note {{declared private here}}
};
@@ -136,7 +136,7 @@ namespace test4 {
union {
int u0; // expected-note {{declared private here}}
double u1; // expected-note {{declared private here}}
- struct { // expected-warning{{anonymous structs are a GNU extension}}
+ struct { // expected-warning{{anonymous structs are a GNU extension}} expected-warning{{nested anonymous type}}
int us0; // expected-note {{declared private here}}
double us1; // expected-note {{declared private here}}
};
@@ -187,7 +187,7 @@ namespace PR8326 {
private:
const union { // expected-warning{{anonymous union cannot be 'const'}}
- struct { // expected-warning{{anonymous structs are a GNU extension}}
+ struct { // expected-warning{{anonymous structs are a GNU extension}} expected-warning{{nested anonymous type}}
T x;
T y;
};
OpenPOWER on IntegriCloud