www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13024] New: [ICE](expression.c line 1172) with implicit

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 puremagic.com
          Reporter: bearophile_hugs 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'

--
Jul 02 2014