[Issue 14128] wrong alias

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 24 08:01:04 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=14128

--- Comment #1 from Basile-z <b2.temp at gmx.com> ---
reduced a bit:

---
struct Foo
{
    int v;
    void test(Foo that) const
    {
        alias a = this.v;
        alias b = that.v;
        assert (&a !is &b);
    }
}

void main ()
{
    Foo a = Foo(1);
    Foo b = Foo(2);
    a.test(b);
}
---

The problem is that `that.v` is an expression and this should not be allowed as
alias RHS. The compiler think that the current `this` is also the one required
for `that`.

--


More information about the Digitalmars-d-bugs mailing list