diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Parse/Parser.cpp | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 1f81202f014..0c68f7664e6 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -324,8 +324,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context, SingleDecl = ParseDeclarationStartingWithTemplate(Context, DeclEnd); break; case tok::kw_inline: - // Could be the start of an inline namespace. - if (getLang().CPlusPlus0x && NextToken().is(tok::kw_namespace)) { + // Could be the start of an inline namespace. Allowed as an ext in C++03. + if (getLang().CPlusPlus && NextToken().is(tok::kw_namespace)) { if (Attr.HasAttr) Diag(Attr.Range.getBegin(), diag::err_attributes_not_allowed) << Attr.Range; diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 26d460c6ffb..b277156a0d0 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -103,6 +103,10 @@ Decl *Parser::ParseNamespace(unsigned Context, return 0; } + // If we're still good, complain about inline namespaces in non-C++0x now. + if (!getLang().CPlusPlus0x && InlineLoc.isValid()) + Diag(InlineLoc, diag::ext_inline_namespace); + // Enter a scope for the namespace. ParseScope NamespaceScope(this, Scope::DeclScope); diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 54053435322..44bd0fbc0c0 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -484,8 +484,8 @@ Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr, } case tok::kw_inline: - if (getLang().CPlusPlus0x && NextToken().is(tok::kw_namespace)) { - // Inline namespaces + if (getLang().CPlusPlus && NextToken().is(tok::kw_namespace)) { + // Inline namespaces. Allowed as an extension even in C++03. SourceLocation DeclEnd; return ParseDeclaration(Declarator::FileContext, DeclEnd, Attr); } |

