Bug 10263 – Refused class opBinary by ref

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-04T04:55:45Z
Last change time
2024-12-13T18:07:35Z
Keywords
diagnostic, rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: dmd#18598 →

Comments

Comment #0 by bearophile_hugs — 2013-06-04T04:55:45Z
class Foo { Foo opBinary(string op)(ref Foo) { return null; } } void main() { auto f = new Foo; auto r1 = f * f; // OK auto r2 = f * (new Foo); // Error. } DMD 2.064alpha gives: test.d(9): Error: 'f' is not of arithmetic type, it is a test.Foo test.d(9): Error: 'new Foo' is not of arithmetic type, it is a test.Foo I think that's a bug. Even if that's not a bug, then I suggest to improve the error messages.
Comment #1 by robert.schadek — 2024-12-13T18:07:35Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18598 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB