[cfe-commits] r166893 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/Parser/namespaces.cpp
Nico Weber
nicolasweber at gmx.de
Sat Oct 27 16:44:27 PDT 2012
Author: nico
Date: Sat Oct 27 18:44:27 2012
New Revision: 166893
URL: http://llvm.org/viewvc/llvm-project?rev=166893&view=rev
Log:
Fix crash on missing namespace name in namespace alias definition -- PR14085.
Patch from Brian Brooks <brooks.brian at gmail.com>!
Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/namespaces.cpp
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=166893&r1=166892&r2=166893&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sat Oct 27 18:44:27 2012
@@ -88,6 +88,12 @@
}
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())
Modified: cfe/trunk/test/Parser/namespaces.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/namespaces.cpp?rev=166893&r1=166892&r2=166893&view=diff
==============================================================================
--- cfe/trunk/test/Parser/namespaces.cpp (original)
+++ cfe/trunk/test/Parser/namespaces.cpp Sat Oct 27 18:44:27 2012
@@ -6,3 +6,7 @@
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}}
More information about the cfe-commits
mailing list