www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4065] New: [CTFE] AA "in" operator doesn't work

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Apr 05 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4065


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #1 from Don <clugdbug yahoo.com.au> 2011-06-17 01:09:17 PDT ---
https://github.com/D-Programming-Language/dmd/commit/19f4e10de21ecf7284227d54b3690d961d2e7e89

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