D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6929 - [ICE] typeMerge crashes in presence of ambiguous alias this conversions
Summary: [ICE] typeMerge crashes in presence of ambiguous alias this conversions
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2011-11-10 08:29 UTC by timon.gehr
Modified: 2011-11-15 21:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description timon.gehr 2011-11-10 08:29:45 UTC
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 Kenji Hara 2011-11-12 07:08:04 UTC
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.