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:
parent
0c58ce9346
commit
729f1e2a1c
|
@ -88,6 +88,12 @@ Decl *Parser::ParseNamespace(unsigned Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tok.is(tok::equal)) {
|
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())
|
if (!attrs.empty())
|
||||||
Diag(attrTok, diag::err_unexpected_namespace_attributes_alias);
|
Diag(attrTok, diag::err_unexpected_namespace_attributes_alias);
|
||||||
if (InlineLoc.isValid())
|
if (InlineLoc.isValid())
|
||||||
|
|
|
@ -6,3 +6,7 @@ namespace g { enum { o = 0 }; }
|
||||||
void foo() {
|
void foo() {
|
||||||
namespace a { typedef g::o o; } // expected-error{{namespaces can only be defined in global or namespace scope}}
|
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}}
|
||||||
|
|
Loading…
Reference in New Issue