[Issue 10452] New: CTFE: if(x is null) Error: cannot compare __lambda1 at compile time

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 23 11:31:07 PDT 2013


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

           Summary: CTFE: if(x is null) Error: cannot compare __lambda1 at
                    compile time
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: destructionator at gmail.com


--- Comment #0 from Adam D. Ruppe <destructionator at gmail.com> 2013-06-23 11:31:05 PDT ---
string foo(bool delegate() bar) {
        return (bar !is null) ? "0" : "1";
}

void main() {
        enum there = foo(() => true);
}

test12.d(2): Error: cannot compare __lambda1 at compile time
test12.d(7):        called from here: foo(bool()
{
return true;
}
)


I understand generally not being able to compare pointers in CTFE, but I think
is null and !is null should be permitted wherever possible because that's
something I do a lot: if(dg is null) return some_default; else return dg(); and
it would be cool if it worked in ctfe too.

Failed on dmd v2.063

-- 
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