www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16570] New: [REG 2.072.0-b1] implicit conversion from int to


          Issue ID: 16570
           Summary: [REG 2.072.0-b1] implicit conversion from int to enum
                    fails when enum type is missing
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

well, don't trust the title too much. Test case:

static immutable int _a = 0;

enum Regression /*:int*/ // OK with a type
    a = _a,

void main()
    Regression reg;
    with(Regression) final switch(reg)
        case a:break;


/tmp/temp_7FCE629C80B0.d(17,14): Error: cannot implicitly convert expression
(0) of type int to Regression

The problem seems more that the enum type is not deduced from the assignations.
Anyway you'll tell me.

Oct 01 2016