Fatal errors disable all further diagnostics. Continuing to permit
template instantiation does nothing but make it take longer for clang to
finish with the TU.
Instead, halt all further instantiation.
Fixed in PR22396.
llvm-svn: 227556
sema::TemplateDeductionInfo *DeductionInfo) {
SavedInNonInstantiationSFINAEContext =
SemaRef.InNonInstantiationSFINAEContext;
+ // Don't allow further instantiation if a fatal error has occcured. Any
+ // diagnostics we might have raised will not be visible.
+ if (SemaRef.Diags.hasFatalErrorOccurred()) {
+ Invalid = true;
+ return;
+ }
Invalid = CheckInstantiationDepth(PointOfInstantiation, InstantiationRange);
if (!Invalid) {
ActiveTemplateInstantiation Inst;