[Issue 17674] New: [REG 2.064] Simultaneous opBinary and opBinaryRight is not rejected
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jul 21 02:31:00 PDT 2017
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 at puremagic.com
Reporter: dlang-bugzilla at 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.
--
More information about the Digitalmars-d-bugs
mailing list