From 75000b68143f0307c170a387a825269b8b4c587e Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 22 Jun 2010 11:30:04 +0000 Subject: [PATCH] Fix PR7180. For void f( a::b::c ); we would cache the tokens "a::b::" but then we would try to annotate them using the range "a::". Before annotating them with the (invalid) C++ scope spec, set it to the range of "a::b::". llvm-svn: 106536 --- clang/lib/Parse/ParseExprCXX.cpp | 10 ++++------ clang/test/Parser/cxx-undeclared-identifier.cpp | 3 +++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index dd74c4e998c9..08357e63f676 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -278,12 +278,10 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, HasScopeSpecifier = true; } - if (SS.isInvalid()) - continue; - - SS.setScopeRep( - Actions.ActOnCXXNestedNameSpecifier(CurScope, SS, IdLoc, CCLoc, II, - ObjectType, EnteringContext)); + if (!SS.isInvalid()) + SS.setScopeRep( + Actions.ActOnCXXNestedNameSpecifier(CurScope, SS, IdLoc, CCLoc, II, + ObjectType, EnteringContext)); SS.setEndLoc(CCLoc); continue; } diff --git a/clang/test/Parser/cxx-undeclared-identifier.cpp b/clang/test/Parser/cxx-undeclared-identifier.cpp index 36d8f7a65381..f15deabc6da5 100644 --- a/clang/test/Parser/cxx-undeclared-identifier.cpp +++ b/clang/test/Parser/cxx-undeclared-identifier.cpp @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s +// PR7180 +int f(a::b::c); // expected-error {{use of undeclared identifier 'a'}} + class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \ // expected-note {{to match this '{'}} \ // expected-error {{expected ';' after class}}