On 10/10/2014 3:20 PM, IgorStepanov wrote:
The same issue also needs to be considered if A and B are structs instead and
B has an additional alias this to an A (the solution might also be part of a
fix for the cycle issue).

- "If resultSet contains more then one candidates, the compiler raises an 
error."

struct A
{
    short s;
    alias s this;
}

struct B
{
    int i;
    alias i this;
}

struct C
{
    A a;
    B b;
    alias a this;
    alias b this;
}

long l = C(); //What do you suggest?

The rule would be if:

   long l = C.a();
   long l = C.b();

both compile, then:

   long l = C();

must be an error, even if one of C.a() or C.b() might be a "better" match. This is how things work for template mixins and imports.

Reply via email to