diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-05-09 23:05:33 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-05-09 23:05:33 +0000 |
commit | 0f8bc97abd6dc531c07c62000e3e836265037382 (patch) | |
tree | 79242cfdfa5d0cb3d51db05a17f41ef1b223d250 /clang/test/SemaCXX/anonymous-union.cpp | |
parent | 16c9491f48f357cb55c2843f0bb368bcb6cf994c (diff) | |
download | bcm5719-llvm-0f8bc97abd6dc531c07c62000e3e836265037382.tar.gz bcm5719-llvm-0f8bc97abd6dc531c07c62000e3e836265037382.zip |
Ignore const/volatile/restrict qualifiers on anonymous structs and
unions. Fixes PR8326.
llvm-svn: 131109
Diffstat (limited to 'clang/test/SemaCXX/anonymous-union.cpp')
-rw-r--r-- | clang/test/SemaCXX/anonymous-union.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/clang/test/SemaCXX/anonymous-union.cpp b/clang/test/SemaCXX/anonymous-union.cpp index 553ae658e53..2dd7ab86a88 100644 --- a/clang/test/SemaCXX/anonymous-union.cpp +++ b/clang/test/SemaCXX/anonymous-union.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s struct X { union { float f3; @@ -17,7 +17,7 @@ struct X { void test_unqual_references(); - struct { + struct { // expected-warning{{anonymous structs are a GNU extension}} int a; float b; }; @@ -125,7 +125,7 @@ typedef struct _s { // <rdar://problem/7987650> namespace test4 { class A { - struct { + struct { // expected-warning{{anonymous structs are a GNU extension}} int s0; // expected-note {{declared private here}} double s1; // expected-note {{declared private here}} union { @@ -136,7 +136,7 @@ namespace test4 { union { int u0; // expected-note {{declared private here}} double u1; // expected-note {{declared private here}} - struct { + struct { // expected-warning{{anonymous structs are a GNU extension}} int us0; // expected-note {{declared private here}} double us1; // expected-note {{declared private here}} }; @@ -175,3 +175,25 @@ void foo_PR6741() { }; } } + +namespace PR8326 { + template <class T> + class Foo { + public: + Foo() + : x(0) + , y(1){ + } + + private: + const union { // expected-warning{{anonymous union cannot be 'const'}} + struct { // expected-warning{{anonymous structs are a GNU extension}} + T x; + T y; + }; + T v[2]; + }; + }; + + Foo<int> baz; +} |