www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13094] New: Refused implicit supertype conversion of

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

          Issue ID: 13094
           Summary: Refused implicit supertype conversion of different
                    enums in array literal
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

enum A { a }
enum B { b }
struct T { A x; B y; }
void main() {
    T t;
    auto r1 = [int(t.x), int(t.y)]; // OK
    auto r2 = [t.tupleof]; // error
}


Gives with dmd 2.066beta2:

test.d(7,16): Error: cannot implicitly convert expression (t.x) of type A to B

--
Jul 11 2014