Bug 17674 – [REG 2.064] Simultaneous opBinary and opBinaryRight is not rejected

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-21T09:31:00Z
Last change time
2024-12-13T18:53:30Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
Vladimir Panteleev
See also
https://issues.dlang.org/show_bug.cgi?id=10478
Moved to GitHub: dmd#19286 →

Comments

Comment #0 by dlang-bugzilla — 2017-07-21T09:31:00Z
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.
Comment #1 by razvan.nitu1305 — 2018-11-06T12:23:52Z
Comment #2 by robert.schadek — 2024-12-13T18:53:30Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19286 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB