digitalmars.D.bugs - [Issue 14806] New: alias this doesn't force elaborate equality, but
- via Digitalmars-d-bugs (39/39) Jul 17 2015 https://issues.dlang.org/show_bug.cgi?id=14806
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: nobody puremagic.com Reporter: ag0aep6g gmail.com Found by TC, who posted to D.learn: http://forum.dlang.org/post/ohkyebycxuszarhtbysm forum.dlang.org 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 */ } ---- --
Jul 17 2015