Bug 13024 – [ICE](expression.c line 1172) with implicit supertype conversion of different enums in array literal
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-02T22:17:00Z
Last change time
2014-08-22T08:04:19Z
Keywords
ice, pull
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2014-07-02T22:17:02Z
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'
Comment #4 by bearophile_hugs — 2014-07-11T07:58:22Z
Reopened, because as explained both here and in the pull request, the pull request fixes only part of the bug. Now this code:
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
Changed the issue name a little because now it's not an ICE, it's a rejects-valid.
Comment #5 by k.hara.pg — 2014-07-11T08:59:47Z
(In reply to bearophile_hugs from comment #4)
> Reopened, because as explained both here and in the pull request, the pull
> request fixes only part of the bug. Now this code:
ICE issue was a regression, but failing common type calculation is not regression. So change 'importance' to normal.
(In next time, please file a new issue instead of reopening)
Comment #6 by bearophile_hugs — 2014-07-11T09:11:03Z
(In reply to Kenji Hara from comment #5)
> (In next time, please file a new issue instead of reopening)
Sorry, I close this now, and I'll reopen another one.
Comment #7 by k.hara.pg — 2014-07-11T09:20:24Z
(In reply to bearophile_hugs from comment #6)
> (In reply to Kenji Hara from comment #5)
>
> > (In next time, please file a new issue instead of reopening)
>
> Sorry, I close this now, and I'll reopen another one.
Thank you.
Comment #8 by github-bugzilla — 2014-07-11T14:46:56Z