https://issues.dlang.org/show_bug.cgi?id=14806
Issue ID: 14806
Summary: alias this doesn't force elaborate equality, but is
followed during it
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: wrong-code
Severity: regression
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Found by TC, who posted to D.learn:
http://forum.dlang.org/post/[email protected]
Either both asserts should pass, or they should both fail.
With dmd 2.062 and older both asserts pass.
----
struct Nullable
{
float get() {return float.nan;}
alias get this;
}
struct Foo(T)
{
T bar;
Nullable baz;
}
void main()
{
Foo!int a, b;
assert(a == b); /* passes, as Nullable.init == Nullable.init */
Foo!string c, d;
assert(c == d); /* fails, as float.init != float.init */
}
----
--