Bug 4141 – unary ++ (post increment) tries and fails to invoke opBinary
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2010-05-01T16:22:00Z
Last change time
2012-12-20T15:11:44Z
Keywords
diagnostic
Assigned to
nobody
Creator
k-foley
Comments
Comment #0 by k-foley — 2010-05-01T16:22:37Z
DMD 2.043
struct A
{
int _;
void opBinary(string op, U)(U rhs) { pragma(msg, op); }
}
auto a = A(42);
a++;
---
$ rdmd opbugs.d
++
opbugs.d(10): Error: template opbugs.main.A.opBinary(string op,U) does not match any function template declaration
opbugs.d(10): Error: template opbugs.main.A.opBinary(string op,U) cannot deduce template function from argument types !()()
Comment #1 by andrej.mitrovich — 2012-12-20T15:11:44Z
Proper error message in 2.060:
test.d(11): Error: 'a += 1' is not a scalar, it is a A
test.d(11): Error: incompatible types for ((a) += (1)): 'A' and 'int'