digitalmars.D.bugs - [Issue 17674] New: [REG 2.064] Simultaneous opBinary and
- via Digitalmars-d-bugs (32/33) Jul 21 2017 https://issues.dlang.org/show_bug.cgi?id=17674
https://issues.dlang.org/show_bug.cgi?id=17674 Issue ID: 17674 Summary: [REG 2.064] Simultaneous opBinary and opBinaryRight is not rejected Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: accepts-invalid Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: dlang-bugzilla thecybershadow.net The example from issue 10478 now compiles, even though it shouldn't: struct S1 { int opBinary(string op)(S2 other) { return 3; } } struct S2 { int opBinaryRight(string op)(S1 other) { return 4; } } void main() { auto x = S1.init + S2.init; } The spec on binary operator overloading ( https://dlang.org/spec/operatoroverloading.html#binary ) states:It is an error for both to equally match.Introduced in https://github.com/dlang/dmd/pull/1409. --
Jul 21 2017