Fix PR9390 in not one, but two ways:

1) When we do an instantiation of the injected-class-name type,
  provide a proper source location. This is just plain good hygiene.

  2) When we're building a NestedNameSpecifierLoc from a CXXScopeSpec,
  only return an empty NestedNameSpecifierLoc if there's no
  representation.

Both problems contributed to the horrible test case in PR9390 that I
couldn't reduce down to something palatable.

llvm-svn: 126961
This commit is contained in:
Douglas Gregor 2011-03-03 21:48:55 +00:00
parent 68a1525290
commit 2b1ca9eaad
2 changed files with 2 additions and 2 deletions

View File

@ -126,7 +126,7 @@ void CXXScopeSpec::Adopt(NestedNameSpecifierLoc Other) {
NestedNameSpecifierLoc
CXXScopeSpec::getWithLocInContext(ASTContext &Context) const {
if (isEmpty() || isInvalid())
if (!Builder.getRepresentation())
return NestedNameSpecifierLoc();
return Builder.getWithLocInContext(Context);

View File

@ -2917,7 +2917,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
// FIXME: Can we use the CurrentInstantiationScope to avoid this
// extra instantiation in the common case?
T = SubstType(T, TemplateArgs, SourceLocation(), DeclarationName());
T = SubstType(T, TemplateArgs, Loc, DeclarationName());
assert(!T.isNull() && "Instantiation of injected-class-name cannot fail.");
if (!T->isDependentType()) {