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

"alias this" does not work with opEquals() #19523

Open
dlangBugzillaToGithub opened this issue Jan 2, 2019 · 0 comments
Open

"alias this" does not work with opEquals() #19523

dlangBugzillaToGithub opened this issue Jan 2, 2019 · 0 comments
Labels
Arch:x86_64 Issues specific to x86_64 Feature:alias alias and alias this OS:Linux P3 Severity:normal

Comments

@dlangBugzillaToGithub
Copy link

Victor Porton (@vporton) reported this on 2019-01-02T07:09:31Z

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

Description

This program does not compile. I think it should do.

---
struct X {
    string m;
    alias m this;
    bool opEquals(const X s) const {
        return true;
    }
}

void main() {
    X* x = new X("");
    assert(*x == "");
}
---

$ dmd --version
DMD64 D Compiler v2.080.1
Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright
$ dmd test.d
test.d(11): Error: function test.X.opEquals(const(X) s) const is not callable using argument types (string)
test.d(11):        cannot pass argument "" of type string to parameter const(X) s
@thewilsonator thewilsonator added the Feature:alias alias and alias this label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch:x86_64 Issues specific to x86_64 Feature:alias alias and alias this OS:Linux P3 Severity:normal
Projects
None yet
Development

No branches or pull requests

2 participants