Thread overview
[Issue 9058] New: Problem with std.traits.EnumMembers conversion to array
Dec 11, 2012
Kenji Hara
November 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9058

           Summary: Problem with std.traits.EnumMembers conversion to
                    array
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2012-11-22 14:46:47 PST ---
import std.traits: EnumMembers;
enum Foo { A, B }
size_t bar(size_t n) {
    return 0;
}
void main() {
    Foo x = [EnumMembers!Foo][bar($)];
}


That code compiles and runs correctly with DMD 2.060, but with DMD 2.061alpha gives:


OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
test.obj(test)
 Error 42: Symbol Undefined _D4test4mainFZv8__dollark


While now this code gives:

import std.traits: EnumMembers;
enum Foo { A, B }
void main() {
    EnumMembers[] array = [EnumMembers!Foo];
}


test.d(4): Error: template std.traits.EnumMembers(E) if (is(E == enum)) is used
as a type

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9058



--- Comment #1 from bearophile_hugs@eml.cc 2012-11-22 14:49:49 PST ---
> While now this code gives:
> 
> import std.traits: EnumMembers;
> enum Foo { A, B }
> void main() {
>     EnumMembers[] array = [EnumMembers!Foo];
> }
> 
> 
> test.d(4): Error: template std.traits.EnumMembers(E) if (is(E == enum)) is used
> as a type

Please ignore this second test case, it's wrong (the array should be Foo[], and it compiles correctly).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9058


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-12-10 21:59:31 PST ---
https://github.com/D-Programming-Language/dmd/pull/1363

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9058



--- Comment #3 from github-bugzilla@puremagic.com 2012-12-11 10:08:49 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/2d79ad35c3c7f624a9c619759852e01bdf9049af fix Issue 9058 - Problem with std.traits.EnumMembers conversion to array

https://github.com/D-Programming-Language/dmd/commit/5752497c08bcfcf4905d5684d1535d1a9e09021f Merge pull request #1363 from 9rnsr/fix9058

Issue 9058 - Problem with std.traits.EnumMembers conversion to array

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9058


bearophile_hugs@eml.cc changed:

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


--- Comment #4 from bearophile_hugs@eml.cc 2012-12-11 11:13:06 PST ---
Seems to work now.

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