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 <[email protected]>! 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}} _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
