Hi,

`Alias this` to mixed in properties does not seem to work, see below. If you think it should, I'll file an issue. Otherwise: can this be made to work somehow?

Interestingly, if you uncomment either the mixin getter or setter (row 36 or 37) and its corresponding use in `main`, then the remaining property works. Does the compiler detect identical names and then does some additional mangling which messes with my `alias this` maybe?

```
import std.stdio;

// version = manual; // Manually written property works, obviously.

mixin template getter()
{
    @property int p()
    {
        writeln(__LINE__, " mixin getter");
        return 3;
    }
}
mixin template setter(T)
{
    @property int p(T arg)
    {
        writeln(__LINE__, " mixin setter ", typeid(T), ' ',  arg);
        return 4;
    }
}
struct S
{
    version (manual) {
        @property int p()
        {
            writeln(__LINE__, " manual getter");
            return 3;
        }
        @property int p(int arg)
        {
            writeln(__LINE__, " manual setter int ",  arg);
            return 4;
        }
    }
    else {
        mixin getter;            // row 36
        mixin setter!int;        // row 37
    }
    alias p this;
}


void main(string[] args)
{
    S s;
    s = 7;
    int i = s;
}
```

Error: cannot implicitly convert expression s of type S to int.

Reply via email to