[Issue 13478] [REG2.066] Templates not emitted when also referenced in speculative contexts

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Sep 15 08:59:37 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13478

David Nadlinger <code at klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|nobody at puremagic.com        |k.hara.pg at gmail.com

--- Comment #3 from David Nadlinger <code at klickverbot.at> ---
Explanation of what happens: During the inline scan semantic, the foo!int
TemplateInstance in 'c' overwrites the instantiatingModule of the one in 'a',
even though it is speculative. Patch, but seems to not occur any longer on
master for a different reason:

diff --git a/src/template.c b/src/template.c
index c230f62..45010ec 100644
--- a/src/template.c
+++ b/src/template.c
@@ -6259,7 +6259,7 @@ void TemplateInstance::semantic(Scope *sc, Expressions
*fargs)
 #if LOG
             printf("\tit's a match with instance %p, %d\n", inst,
inst->semanticRun);
 #endif
-            if (!inst->instantiatingModule ||
inst->instantiatingModule->isRoot())
+            if (!speculative && (!inst->instantiatingModule ||
inst->instantiatingModule->isRoot()))
                 inst->instantiatingModule = mi;
             errors = inst->errors;
             return;

--


More information about the Digitalmars-d-bugs mailing list