Skip to content

Commit

Permalink
Issue 14743 - ICE in TemplateInstance::needsTypeInference() with temp…
Browse files Browse the repository at this point in the history
…late forward reference
  • Loading branch information
ibuclaw committed Jul 23, 2017
1 parent b740a28 commit 0f2b762
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -7169,6 +7169,20 @@ bool TemplateInstance::needsTypeInference(Scope *sc, int flag)
*/
dedtypes.setDim(td->parameters->dim);
dedtypes.zero();
if (td->semanticRun == PASSinit)
{
if (td->_scope)
{
// Try to fix forward reference. Ungag errors while doing so.
Ungag ungag = td->ungagSpeculative();
td->semantic(td->_scope);
}
if (td->semanticRun == PASSinit)
{
ti->error("%s forward references template declaration %s", ti->toChars(), td->toChars());
return 1;
}
}
assert(td->semanticRun != PASSinit);
MATCH m = td->matchWithInstance(sc, ti, &dedtypes, NULL, 0);
if (m <= MATCHnomatch)
Expand Down

0 comments on commit 0f2b762

Please sign in to comment.