Skip to content

Commit

Permalink
fix Issue 8002 - Excess initial errors when passing template args to …
Browse files Browse the repository at this point in the history
…non-templated struct
  • Loading branch information
9rnsr committed Apr 30, 2012
1 parent 9c8b749 commit 81eca37
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/template.c
Expand Up @@ -4486,19 +4486,27 @@ void TemplateInstance::semantic(Scope *sc, Expressions *fargs)
}
else
{
/* Find template declaration first.
*/
tempdecl = findTemplateDeclaration(sc);
if (!tempdecl)
{ inst = this;
//printf("error return %p, %d\n", tempdecl, global.errors);
return; // error recovery
}

/* Run semantic on each argument, place results in tiargs[]
* (if we havetempdecl, then tiargs is already evaluated)
* (if we have tempdecl, then tiargs is already evaluated)
*/
semanticTiargs(sc);
if (arrayObjectIsError(tiargs))
{ inst = this;
//printf("error return %p, %d\n", tempdecl, global.errors);
return; // error recovery
}

unsigned errs = global.errors;
tempdecl = findTemplateDeclaration(sc);
if (tempdecl)
tempdecl = findBestMatch(sc, fargs);
tempdecl = findBestMatch(sc, fargs);
if (!tempdecl || (errs != global.errors))
{ inst = this;
//printf("error return %p, %d\n", tempdecl, global.errors);
Expand Down

0 comments on commit 81eca37

Please sign in to comment.