implicit conversion to alias this

Tobias Pankrath tobias at pankrath.net
Mon Jun 25 13:06:20 PDT 2012


---------
struct A { bool a; alias a this; }
struct B { int b; alias b this; }

A a = false; // works
B b = 12; // works

struct C
{
     A aa;
     B ab;
}

C c = { false, 12 }; // does not work, because the implicit 
conversion does not happen.
-----

What is the reason to allow the first two assignments? Isn't it 
just another implicit conversion that shouldn't be allowed?




More information about the Digitalmars-d-learn mailing list