Adam Burton <[email protected]> wrote:
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.
Far as I know, that's not supposed to work, no. Guess it has to do with
overloading:
struct foo {
this( int n ){}
}
void bar( foo f ) {}
void bar( int n ) {}
bar( 3 ); // which do I call?
--
Simen
