Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refused class opBinary by ref #18598

Open
dlangBugzillaToGithub opened this issue Jun 4, 2013 · 0 comments
Open

Refused class opBinary by ref #18598

dlangBugzillaToGithub opened this issue Jun 4, 2013 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

bearophile_hugs reported this on 2013-06-04T04:55:45Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=10263

Description

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant