[Issue 13024] New: [ICE](expression.c line 1172) with implicit supertype conversion of different enums in array literal

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 2 15:17:02 PDT 2014


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

          Issue ID: 13024
           Summary: [ICE](expression.c line 1172) with implicit supertype
                    conversion of different enums in array literal
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: bearophile_hugs at eml.cc

void main() {
    import std.typecons;
    enum A { a }
    enum B { b }
    int i = 1;
    Tuple!(A, B) t;
    auto r = [t[]][i];
}



test.d(7,15): Error: cannot implicitly convert expression (t._expand_field_0)
of type A to B
Assertion failure: 'e->op != TOKerror' on line 1172 in file 'expression.c'


Reduced:

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]; // crash
}


test.d(7,16): Error: cannot implicitly convert expression (t.x) of type A to B
Assertion failure: 'e->op != TOKerror' on line 1172 in file 'expression.c'

--


More information about the Digitalmars-d-bugs mailing list