[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 20 22:30:57 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4302


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from Don <clugdbug at yahoo.com.au> 2010-08-20 22:30:55 PDT ---
The cause of the regression was this line at the end of
TemplateInstance::semantic()
around line 3980:

        if (global.gag)
        {   // Try to reset things so we can try again later to instantiate it
            tempdecl->instances.remove(tempdecl_instance_idx);
+            semanticRun = 0;
+            inst = NULL;
        }
This code was added in svn 477, to fix bug 4042. 
BUT... removing those lines, bug 4042 still passes, and the test suite still
passes. So patch option #1 is to simply remove them.

Patch option #2: If those lines should really remain, then we should definitely
not reset for a later attempt, if the instantiation was made from inside a
static if. You only get chance at a static if.
Note that template constraints set the SCOPEstaticif flag.

// template.c, line 3982.

        if (global.gag)
        {   // Try to reset things so we can try again later to instantiate it
            tempdecl->instances.remove(tempdecl_instance_idx);
+         if (!(sc->flags & SCOPEstaticif))
+         {
            semanticRun = 0;
            inst = NULL;
+         }
    }

Thirdly, it is in fact possible that what we're seeing is a consequence of
bug4269, ie is a bug in is(). If so, then this patch is just a temporary
workaround until that deeper bug is fixed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list