Bug 6929 – [ICE] typeMerge crashes in presence of ambiguous alias this conversions
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-11-10T08:29:00Z
Last change time
2011-11-15T21:26:02Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
timon.gehr
Comments
Comment #0 by timon.gehr — 2011-11-10T08:29:45Z
T t;
S s;
struct S{
T get() const {return t;}
alias get this;
}
struct T{
S get() const {return s;}
alias get this;
}
static assert(is(typeof(1? t:s)));
Fails with:
dmd: cast.c:1908: int typeMerge(Scope*, Expression*, Type**, Expression**, Expression**): Assertion `!(i1 && i2)' failed.
Comment #1 by k.hara.pg — 2011-11-12T07:08:04Z
In this case, S and T don't have common type.
With the expression (1? t:s), two expansions of alias this exist.
One of them is
1? t.get():s, type == S
Other is
1? t:s.get(), type == T
This ambiguate should cause error.
But, ICE is bad. It should be fixed.