Permalink
Browse files

Merge pull request #915 from 9rnsr/fix8002

Issue 8002 - Excess initial errors when passing template args to non-templated struct
  • Loading branch information...
2 parents 9c8b749 + 81eca37 commit d303d30500689dc4f9c9b60ae4b497549887c2b4 @WalterBright WalterBright committed Apr 30, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/template.c
View
@@ -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);

0 comments on commit d303d30

Please sign in to comment.