[Issue 4065] New: [CTFE] AA "in" operator doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 5 05:41:17 PDT 2010


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

           Summary: [CTFE] AA "in" operator doesn't work
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-04-05 05:41:16 PDT ---
bool foo(string s) {
    enum int[string] aa = ["aa":1, "bb":2];
    return cast(bool)(s in aa);
}
enum bool r = foo("xx");
void main() {}


dmd 2.042 gives:

test.d(3): Error: Cannot interpret s in (["aa":1,"bb":2]) at compile time
test.d(5): Error: cannot evaluate foo("xx") at compile time
test.d(5): Error: cannot evaluate foo("xx") at compile time


I have tagged this as major bug because it limits a lot the uses of AAs in
CTFE. And AA.get too is not available yet at compile-time.
I presume this is caused by the pointers that are not available yet at
compile-time.

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