[Issue 5437] New: Problems with length of std.traits.EnumMembers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 9 04:12:53 PST 2011


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

           Summary: Problems with length of std.traits.EnumMembers
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-01-09 04:11:08 PST ---
A D2 program:

import std.traits: EnumMembers;
enum Foo { A, B }
void main() {
    alias EnumMembers!Foo members; // OK
    enum n1 = members.length; // OK
    enum n2 = (EnumMembers!Foo).length; // line 6, Error
}


DMD 2.051 shows the error:
test.d(6): Error: EnumMembers!(Foo) is used as a type

------------------------

A similar program:

import std.traits: EnumMembers;
enum Foo { A, B }
void main() {
    alias EnumMembers!Foo members;
    enum n = members.length; // OK
    int[n] data1; // OK
    int[members.length] data2; // line 7, ERROR
}


DMD 2.051 shows the errors:
test.d(7): Error: identifier 'length' of 'members.length' is not defined
test.d(7): Error: index is not a type or an expression

I have add a "DMD" tag for the Component of this bug because I am not sure
about the cause.

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