diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index bc162fc6978..b2fa88db2b6 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -3854,7 +3854,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { if (getLangOpts().CPlusPlus11 && isCXX11AttributeSpecifier()) { if (!getLangOpts().CPlusPlus1z) Diag(Tok.getLocation(), diag::warn_cxx14_compat_attribute) - << "enumerator"; + << 1 /*enumerator*/; ParseCXX11Attributes(attrs); } diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 1f56c8ba3b5..7c98d70b683 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -77,7 +77,8 @@ Decl *Parser::ParseNamespace(unsigned Context, SourceLocation attrLoc; if (getLangOpts().CPlusPlus11 && isCXX11AttributeSpecifier()) { if (!getLangOpts().CPlusPlus1z) - Diag(Tok.getLocation(), diag::warn_cxx14_compat_attribute) << "namespace"; + Diag(Tok.getLocation(), diag::warn_cxx14_compat_attribute) + << 0 /*namespace*/; attrLoc = Tok.getLocation(); ParseCXX11Attributes(attrs); } @@ -92,6 +93,10 @@ Decl *Parser::ParseNamespace(unsigned Context, } } + // A nested namespace definition cannot have attributes. + if (!ExtraNamespaceLoc.empty() && attrLoc.isValid()) + Diag(attrLoc, diag::err_unexpected_nested_namespace_attribute); + // Read label attributes, if present. if (Tok.is(tok::kw___attribute)) { attrLoc = Tok.getLocation(); |