Fix crash on missing namespace name in namespace alias definition -- PR14085.

Patch from Brian Brooks <brooks.brian@gmail.com>!

llvm-svn: 166893
This commit is contained in:
Nico Weber 2012-10-27 23:44:27 +00:00
parent 0c58ce9346
commit 729f1e2a1c
2 changed files with 10 additions and 0 deletions

View File

@ -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())

View File

@ -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}}