www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5795] New: enum x = CustomType; should be a syntax error

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: kennytm gmail.com



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: -------
Mar 30 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5795


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Severity|normal                      |regression




 In 2.042 this was a syntax error. http://ideone.com/BNcSh
Looks to me like a semantic, not syntax, error. It can't be a syntax error, because that would cause it to fail if Bar is the name of a compile-time constant. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 09 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5795


kennytm gmail.com changed:

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



*** This issue has been marked as a duplicate of issue 4206 ***

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