[Issue 6280] New: [CTFE] Cannot put 'in' expression of AA in an 'if' condition

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 10 04:21:30 PDT 2011


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

           Summary: [CTFE] Cannot put 'in' expression of AA in an 'if'
                    condition
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-07-10 04:16:22 PDT ---
Test case:

--------------------------------
static assert({
    if (0 in [0:0]) {}
    return true;
}());
--------------------------------
x.d(4): Error: cannot evaluate delegate pure nothrow bool()
{
if (0 in [0:0])
{
}
return true;
}
() at compile time
x.d(1): Error: static assert  (delegate pure nothrow bool()
{
if (0 in [0:0])
{
}
return true;
}
()) is not evaluatable at compile time
--------------------------------

Calling 'if((a in b) !is null)' can workaround the problem.

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