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

           Summary: && doesn't shortcut properly with CTFE
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: jmdavisp...@gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisp...@gmx.com> 2011-06-02 21:18:02 
PDT ---
This

bool func(alias pred = "a == b")(dchar a, dchar b)
{
    enum defaultPred = is(typeof(pred) : string) && pred == "a == b";

    return defaultPred;
}

void main()
{
    func('a', 'b');
    func!((dchar a, dchar b){return false;})('a', 'b');
}


fails to compile, giving this error:

q.d(3): Error: incompatible types for ((__dgliteral1) == ("a == b")): 'bool
delegate(dchar a, dchar b)' and 'string'
q.d(11): Error: template instance q.main.func!(delegate bool(dchar a, dchar b)
{
return false;
}
) error instantiating

It's obviously trying to evaluate pred == "a == b" in spite of the fact that
is(typeof(pred) : string) failed, which means that && isn't shortcutting like
it's supposed to.

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

Reply via email to