diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2014-06-24 16:22:41 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2014-06-24 16:22:41 +0000 |
| commit | f93ef4e45029908df3eedc6d1a70d2911c179d7f (patch) | |
| tree | e495ad635c4aab1e4be973bc562e8d58fcbc4571 | |
| parent | b1d4dbdcc7ef0791e8d5cc4a0b3dbe971d56fb78 (diff) | |
| download | bcm5719-llvm-f93ef4e45029908df3eedc6d1a70d2911c179d7f.tar.gz bcm5719-llvm-f93ef4e45029908df3eedc6d1a70d2911c179d7f.zip | |
Allow static_assert inside an anonymous union; fixes PR20021 as well as implements C++ Issue 1940.
llvm-svn: 211606
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/anonymous-union-cxx11.cpp | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index bdc8609116f..90499d2749e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3754,6 +3754,8 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, } } else if (isa<AccessSpecDecl>(Mem)) { // Any access specifier is fine. + } else if (isa<StaticAssertDecl>(Mem)) { + // In C++1z, static_assert declarations are also fine. } else { // We have something that isn't a non-static data // member. Complain about it. diff --git a/clang/test/SemaCXX/anonymous-union-cxx11.cpp b/clang/test/SemaCXX/anonymous-union-cxx11.cpp index 9f987a9681c..b0dd1a874de 100644 --- a/clang/test/SemaCXX/anonymous-union-cxx11.cpp +++ b/clang/test/SemaCXX/anonymous-union-cxx11.cpp @@ -12,3 +12,12 @@ namespace PR12866 { (void)sizeof(bar::member); } } + +namespace PR20021 { +class C { + union { + static_assert(true, ""); + int i; + }; +}; +} |

