forked from OSchip/llvm-project
After an error of any kind has occurred, don't assert when attempting
to find the instantiated declaration within a template instantiation fails to do so. It's likely that the original instantiation got dropped due to instantiation failures, which doesn't actually break the invariants of the AST. This eliminates a number of crash-on-invalid failures, e.g., PR9300. llvm-svn: 127030
This commit is contained in:
parent
8887d6593f
commit
8c2d3f4248
|
@ -3031,9 +3031,11 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
|
||||||
}
|
}
|
||||||
|
|
||||||
// UsingShadowDecls can instantiate to nothing because of using hiding.
|
// UsingShadowDecls can instantiate to nothing because of using hiding.
|
||||||
assert((Result || isa<UsingShadowDecl>(D) || D->isInvalidDecl() ||
|
// Note: this assertion end up firing in invalid code even when none of the
|
||||||
cast<Decl>(ParentDC)->isInvalidDecl())
|
// AST invariants have been broken, so we explicitly check whether any
|
||||||
&& "Unable to find instantiation of declaration!");
|
// errors have been emitted
|
||||||
|
assert((Result || isa<UsingShadowDecl>(D) || Diags.hasErrorOccurred()) &&
|
||||||
|
"Unable to find instantiation of declaration!");
|
||||||
|
|
||||||
D = Result;
|
D = Result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue