[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE
https://issues.dlang.org/show_bug.cgi?id=4302 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Version|D1 D2 |D2 --
[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=4302 klickverbot c...@klickverbot.at changed: What|Removed |Added CC||c...@klickverbot.at --- Comment #9 from klickverbot c...@klickverbot.at 2011-09-04 21:44:14 PDT --- This turned out to be an incomplete fix since this situation can not only occur in static ifs, see bug 6602. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=4302 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||FIXED --- Comment #8 from Walter Bright bugzi...@digitalmars.com 2010-08-27 00:26:49 PDT --- http://www.dsource.org/projects/dmd/changeset/632 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=4302 --- Comment #6 from Don clugd...@yahoo.com.au 2010-08-22 12:53:11 PDT --- (In reply to comment #5) Or maybe even simpler: it's probably not necessary to add the template as a member to the module if it is instantiated in a static if or similar. I think you're right. Maybe it should not be added, if it is only instantiated in an is expression (rather using static if as the criterion). But that might make compile times blow out, if an is() occurs in a loop. That may be the root cause of bug 4269 and bug 3996, as well. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=4302 --- Comment #7 from Rainer Schuetze r.sagita...@gmx.de 2010-08-22 13:56:02 PDT --- It seems to me that the module member list is not searched when looking for existing template instantations, but templdecl-instances. The failed template instance is currently removed from that array, so it should do no extra harm to remove it from the member list aswell. issue 4269 does not deal with templates, so it will not change with a fix to this bug. It's kind of the reverse problem: the declaration exists in the member list, but is not revisited after causing an error once. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=4302 --- Comment #4 from Rainer Schuetze r.sagita...@gmx.de 2010-08-21 00:49:23 PDT --- (In reply to comment #3) 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; } The template is also added to the member list of the importing scope/module (lines 3752+). I guess this should be undone aswell. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=4302 --- Comment #5 from Rainer Schuetze r.sagita...@gmx.de 2010-08-21 01:20:14 PDT --- Or maybe even simpler: it's probably not necessary to add the template as a member to the module if it is instantiated in a static if or similar. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=4302 Don clugd...@yahoo.com.au changed: What|Removed |Added Version|D2 |D1 D2 Summary|Regression(2.046): compiler |Regression(2.046, 1.061): |errors using startsWith in |compiler errors using |CTFE|startsWith in CTFE --- Comment #2 from Don clugd...@yahoo.com.au 2010-08-20 22:25:27 PDT --- Reduced test case shows it doesn't require template constraints, and applies to D1 as well. Passes on D1.060, fails on D1.061. - template fail4302() { static assert(0); } template bug4302() { alias fail4302!() bad; } static if (is(bug4302!())) {} // And this case broke one of my early attempts to fix it template tough4302() { template bar() { template far() { static assert(0); } alias far!() par; } static if (is(bar!())) {} } alias tough4302!() tougher; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4302] Regression(2.046, 1.061): compiler errors using startsWith in CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=4302 Don clugd...@yahoo.com.au changed: What|Removed |Added Keywords||patch --- Comment #3 from Don clugd...@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: ---