Bug 10478 – Crappy error message when two operator overloads match

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-26T10:24:07Z
Last change time
2024-12-13T18:08:39Z
Keywords
bootcamp, diagnostic
Assigned to
No Owner
Creator
Simen Kjaeraas
See also
https://issues.dlang.org/show_bug.cgi?id=17674
Moved to GitHub: dmd#17596 →

Comments

Comment #0 by simen.kjaras — 2013-06-26T10:24:07Z
struct S1 { int opBinary(string op)(S2 other) { return 3; } } struct S2 { int opBinaryRight(string op)(S1 other) { return 4; } } void main( ) S1.init + S2.init; } foo.d(97): Error: overloads pure nothrow @safe int(S2 other) and pure nothrow @safe int(S1 other) both match argument list for opBinary I would really like to see some more information here - FQN and line numbers would go a long way.
Comment #1 by dlang-bugzilla — 2017-07-21T09:33:40Z
The test case above now incorrectly compiles due to issue 17674, but the bug here can still be observed with the old opXXX operator overloading method. //////////////// test.d /////////////// struct S1 { int opAdd(S2 other) { return 3; } } struct S2 { int opAdd_r(S1 other) { return 3; } } void main() { auto x = S1.init + S2.init; } ///////////////////////////////////////
Comment #2 by robert.schadek — 2024-12-13T18:08:39Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17596 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB