diff options
author | Chris Lattner <sabre@nondot.org> | 2008-12-18 01:12:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-12-18 01:12:00 +0000 |
commit | bc8d56496a6ecdba14769df03d75c001184f8c54 (patch) | |
tree | f7ba6231add5216bfee499ba3d1f5a7cb560252b | |
parent | e6046285890cbd2be24933df32f0fd695ae9cd94 (diff) |
implement PR3177 - "__extension__ union" not supported in C++ mode
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61180 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 10 | ||||
-rw-r--r-- | test/Parser/cxx-class.cpp | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index ec2a37a852..eaada1c26c 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -16,6 +16,7 @@ #include "clang/Parse/DeclSpec.h" #include "clang/Parse/Scope.h" #include "AstGuard.h" +#include "ExtensionRAIIObject.h" using namespace clang; /// ParseNamespace - We know that the current token is a namespace keyword. This @@ -408,6 +409,7 @@ AccessSpecifier Parser::getAccessSpecifierIfPresent() const /// using-declaration [TODO] /// [C++0x] static_assert-declaration [TODO] /// template-declaration [TODO] +/// [GNU] '__extension__' member-declaration /// /// member-declarator-list: /// member-declarator @@ -425,6 +427,14 @@ AccessSpecifier Parser::getAccessSpecifierIfPresent() const /// '=' constant-expression /// Parser::DeclTy *Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) { + // Handle: member-declaration ::= '__extension__' member-declaration + if (Tok.is(tok::kw___extension__)) { + // __extension__ silences extension warnings in the subexpression. + ExtensionRAIIObject O(Diags); // Use RAII to do this. + ConsumeToken(); + return ParseCXXClassMemberDeclaration(AS); + } + SourceLocation DSStart = Tok.getLocation(); // decl-specifier-seq: // Parse the common declaration-specifiers piece. diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp index 5afa8d6ac2..39b787fc8d 100644 --- a/test/Parser/cxx-class.cpp +++ b/test/Parser/cxx-class.cpp @@ -27,3 +27,12 @@ void glo() { struct local {}; } + +// PR3177 +typedef union { + __extension__ union { + int a; + float b; + } y; +} bug3177; + |