[Issue 5795] New: enum x = CustomType; should be a syntax error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 30 08:18:49 PDT 2011


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

           Summary: enum x = CustomType; should be a syntax error
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-03-30 08:15:15 PDT ---
Currently (v2.052) it is possible to do

-------

struct Bar {    // Bar can be a struct, a class, a union or an enum.
    int x;
    int y;
}

void main() {
    enum z = Bar;      // <------
    auto w = z(1, 2);
}

-------

The effect is the same as 'alias Bar z;'. However, the RHS of an 'enum'
statement should only accept an AssignExpression, not a custom type. Either the
D compiler should reject this, or the spec should be clarified to allow this.

In 2.042 this was a syntax error. http://ideone.com/BNcSh

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