diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 6 | ||||
-rw-r--r-- | clang/test/Parser/namespaces.cpp | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 492250da1d4..4cb14e24f48 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -88,6 +88,12 @@ Decl *Parser::ParseNamespace(unsigned Context, } if (Tok.is(tok::equal)) { + if (Ident == 0) { + Diag(Tok, diag::err_expected_ident); + // Skip to end of the definition and eat the ';'. + SkipUntil(tok::semi); + return 0; + } if (!attrs.empty()) Diag(attrTok, diag::err_unexpected_namespace_attributes_alias); if (InlineLoc.isValid()) diff --git a/clang/test/Parser/namespaces.cpp b/clang/test/Parser/namespaces.cpp index b8c7819a019..6491cfd446b 100644 --- a/clang/test/Parser/namespaces.cpp +++ b/clang/test/Parser/namespaces.cpp @@ -6,3 +6,7 @@ namespace g { enum { o = 0 }; } void foo() { namespace a { typedef g::o o; } // expected-error{{namespaces can only be defined in global or namespace scope}} } + +// PR14085 +namespace PR14085 {} +namespace = PR14085; // expected-error {{expected identifier}} |