[Issue 16570] New: [REG 2.072.0-b1] implicit conversion from int to enum fails when enum type is missing

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Oct 1 16:14:27 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16570

          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 at puremagic.com
          Reporter: b2.temp at 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;
    }
}
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

error:

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

--


More information about the Digitalmars-d-bugs mailing list