Bug 14806 – [REG2.063] alias this doesn't force elaborate equality, but is followed during it

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-07-17T18:10:00Z
Last change time
2015-07-24T03:20:22Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
ag0aep6g

Comments

Comment #0 by ag0aep6g — 2015-07-17T18:10:37Z
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 */ } ----
Comment #1 by k.hara.pg — 2015-07-19T03:48:36Z
(In reply to ag0aep6g from comment #0) > Either both asserts should pass, or they should both fail. Both asserts should fail, because they should be translated as follows: Foo!int a, b; assert(a == b); // ==> a.tupleof == b.tupleof // ==> a.bar == b.bar && a.baz.get() == b.baz.get() Foo14806!string c, d; assert(c == d); // ==> c.tupleof == d.tupleof // ==> c.bar == d.bar && c.baz.get() == d.baz.get() Compiler fix (targetting 2.068 release): https://github.com/D-Programming-Language/dmd/pull/4820
Comment #2 by github-bugzilla — 2015-07-19T05:11:18Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/83fa6accb7b83f3a88898a675933319073e3497e fix Issue 14806 - alias this doesn't force elaborate equality, but is followed during it https://github.com/D-Programming-Language/dmd/commit/9318101daf48fb24b335cb6177c509bfec390586 Merge pull request #4820 from 9rnsr/fix14806 [REG2.063] Issue 14806 - alias this doesn't force elaborate equality, but is followed during it
Comment #3 by github-bugzilla — 2015-07-24T03:20:22Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/83fa6accb7b83f3a88898a675933319073e3497e fix Issue 14806 - alias this doesn't force elaborate equality, but is followed during it https://github.com/D-Programming-Language/dmd/commit/9318101daf48fb24b335cb6177c509bfec390586 Merge pull request #4820 from 9rnsr/fix14806