Skip to content

Commit

Permalink
Simply or the conditions in Template(Instance|Mixin)::semantic
Browse files Browse the repository at this point in the history
Pointed out by you Martin Nowak.
  • Loading branch information
9rnsr committed Feb 27, 2013
1 parent 0c14131 commit 33675f7
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions src/template.c
Expand Up @@ -4835,19 +4835,14 @@ void TemplateInstance::semantic(Scope *sc, Expressions *fargs)
}
else
{
/* Find template declaration first.
/* Find template declaration first,
* then run semantic on each argument (place results in tiargs[]),
* last find most specialized template from overload list/set.
*/
if (!findTemplateDeclaration(sc))
goto Lerr;

/* Run semantic on each argument, place results in tiargs[]
*/
if (!semanticTiargs(sc))
goto Lerr;

if (!findBestMatch(sc, fargs))
if (!findTemplateDeclaration(sc) ||
!semanticTiargs(sc) ||
!findBestMatch(sc, fargs))
{
Lerr:
if (!sc->parameterSpecialization)
inst = this;
//printf("error return %p, %d\n", tempdecl, global.errors);
Expand Down Expand Up @@ -6398,16 +6393,14 @@ void TemplateMixin::semantic(Scope *sc)
}
}

// Run semantic on each argument, place results in tiargs[]
if (!semanticTiargs(sc)/* || errors*/)
goto Lerr;

// Find best match template with tiargs
if (!findBestMatch(sc, NULL))
/* Run semantic on each argument, place results in tiargs[],
* then find best match template with tiargs
*/
if (!semanticTiargs(sc) ||
!findBestMatch(sc, NULL))
{
Lerr:
inst = this;
inst->errors = true; //?
inst->errors = true;
return; // error recovery
}

Expand Down

0 comments on commit 33675f7

Please sign in to comment.