From 33675f7583cbf182195039f8d25316db8331d50f Mon Sep 17 00:00:00 2001 From: k-hara Date: Wed, 27 Feb 2013 09:25:55 +0900 Subject: [PATCH] Simply or the conditions in Template(Instance|Mixin)::semantic Pointed out by you Martin Nowak. --- src/template.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/template.c b/src/template.c index 586765d0c383..6439198abf43 100644 --- a/src/template.c +++ b/src/template.c @@ -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); @@ -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 }