Thread overview
[Issue 6280] New: [CTFE] Cannot put 'in' expression of AA in an 'if' condition
Jul 10, 2011
kennytm@gmail.com
Jul 10, 2011
kennytm@gmail.com
Jul 26, 2011
Walter Bright
July 10, 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@puremagic.com
        ReportedBy: kennytm@gmail.com


--- Comment #0 from kennytm@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: -------
July 10, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6280



--- Comment #1 from kennytm@gmail.com 2011-07-10 06:00:06 PDT ---
The problem is there isn't an IndexExp::isBool.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 26, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6280


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-07-26 15:18:16 PDT ---
https://github.com/D-Programming-Language/dmd/commit/0904c8aa200e4d080d500d96d5904c33ba17cc86

https://github.com/D-Programming-Language/dmd/commit/e48a8c67f02172c72e04f36759d2d6868d716368

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