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


yebblies <yebbl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebbl...@gmail.com


--- Comment #3 from yebblies <yebbl...@gmail.com> 2011-08-27 21:06:24 EST ---
(In reply to comment #2)
> The test case was accidentally fixed by commit:
> https://github.com/D-Programming-Language/dmd/commit/dc83c
> but I don't really understand why. It seems to be just luck.

dc83c prevents dmd from re-evaluating the template constraint when the args
match an instance that already exists.  Previously the constraint would be run
unless all template args had a spec.  You can see this by changing 'void
bug6385(A)(A a) if (template6385!A)' to 'void bug6385(A : ubyte[2])(A a) if
(template6385!A)'.

Slightly smaller test case:
void templ6385(A)(A a) if ( { return false; }() )
{
    this_is_an_error();
}

const bool bool6385 =
    is(typeof(
    {
        this_is_another_error();
        templ6385(1);
    }()
    ));

    void main() {}

Using an older commit, it seems that the cause is re-running semantic on
templ6385, as it's been added to the list of module members.  This seems to be
similar to issue 4302 (caused by the fix to bug 4042) but missed by the patch
in 4302.

Changing
- if (!(sc->flags & SCOPEstaticif))
+ if (!(sc->flags & SCOPEstaticif) && !sc->intypeof)
from that patch seems to fix it, but I have no idea if there are any other
missing cases.

My guess at a correct solution is that
http://www.dsource.org/projects/dmd/changeset/477 is incorrect, and should
instead remove the TemplateInstance from the module's list of members.

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

Reply via email to