struct constructors and function parameters

Adam Burton adz21c at gmail.com
Tue Nov 9 15:48:27 PST 2010


Hi,
should the below work? 

struct A
{
    public this(B b) {}
}

struct B {}

void foo(A a) {}

void main()
{
    B b;
    foo(b);     // Fails
}

The constructor parameter doesn't need to be a struct, it could be an int. 
The workaround is to explicity call the constructor.


More information about the Digitalmars-d-learn mailing list