http://d.puremagic.com/issues/show_bug.cgi?id=4302
--- Comment #1 from Rainer Schuetze <r.sagita...@gmx.de> 2010-06-13 01:23:38 PDT --- I've tried to untangle the startsWith code, and here's the minimal test case I could come up with so far: /////////////////////// template binaryFunImpl(bool b) { template Body() { static assert(b); alias bool BodyType; } alias Body!().BodyType ReturnType; // line 9 } uint startsWith(A)(A a) if (is(binaryFunImpl!(true ).ReturnType)) { return 1; } uint startsWith(A)(A a) if (is(binaryFunImpl!(false).ReturnType)) { return 0; } // line 13 const uint var = startsWith(1); /////////////////////// dmd produces: test.d(6): Error: static assert (b) is false test.d(9): instantiated from here: Body!() test.d(13): instantiated from here: binaryFunImpl!(false) The error does not show up if var is not const. Also, dmd 2.032 to 2.045 do not produce this error (2.046 fails), so it seems a compiler regression being triggered with the new implementation of startsWith. This is what happens: while deducing a template match, - a template instance of binaryFunImpl!false is created to evaluate is(binaryFunImpl!(false).ReturnType) - the template instance is added as a member to the module (template.c(3779)) - semantic analysis fails, so the respective startsWith alternative is rejected - compiler attempts to compile added binaryFunImpl!false and fails maybe, the template instance should be removed from the module member list at template.c(3975) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------