On 10/10/2014 10:09 AM, IgorStepanov wrote:
Please, comment it.

> static assert(is(C : int)); //Ok, because C is subtype of int anyway.

Comment should say that C is implicitly convertible to int

    struct Test1
    {
        int a;
        int b;
        alias a this;
        alias b this; //Error: alias b this conflicts with alias a this;
    }

DIP says this is "obviously incorrect", but what rule is being applied? I suspect the rule here is if typeof(a)==typeof(b), then it is rejected.

What if typeof(a) is implicitly convertible to typeof(b), and vice-versa?

Is alias this resolved before base class search, after base class search, or is it an error if both searches are successful?

If 'a' and 'b' both contain overloads for function foo, then it should behave like imports do (which is a bit complex).


Essentially, the rules for multiple alias this should be the same as for multiple imports and multiple mixin templates. These rules work, and the consistency will be expected.

Reply via email to