diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-06-12 15:46:16 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-06-12 15:46:16 +0000 |
commit | 29cafa66ad3878dbb9f82615f19fa0bded2e443c (patch) | |
tree | c5e9e10bc189de0058aa763c47b9920a8351b7df /test/SemaCXX/anonymous-union.cpp | |
parent | 01af97d3b23bded2b2b21af19bbc6e4cce49e5b3 (diff) | |
download | src-29cafa66ad3878dbb9f82615f19fa0bded2e443c.tar.gz src-29cafa66ad3878dbb9f82615f19fa0bded2e443c.zip |
Vendor import of clang trunk r132879:vendor/clang/clang-r132879
Notes
Notes:
svn path=/vendor/clang/dist/; revision=223015
svn path=/vendor/clang/clang-r132879/; revision=223016; tag=vendor/clang/clang-r132879
Diffstat (limited to 'test/SemaCXX/anonymous-union.cpp')
-rw-r--r-- | test/SemaCXX/anonymous-union.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/test/SemaCXX/anonymous-union.cpp b/test/SemaCXX/anonymous-union.cpp index 553ae658e53b..2dd7ab86a88d 100644 --- a/test/SemaCXX/anonymous-union.cpp +++ b/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; +} |