implicit constructors

Trass3r un at known.com
Thu Nov 24 13:43:25 PST 2011


Seems like this is a CTFE-only issue?

import std.stdio;
struct A
{
	int store;

	this(int a)
	{
		store = a << 3;
		//...
	}
}

A a = 5; // Error: cannot implicitly convert expression (5) of type int to  
A

void main()
{
	A a = 5; // fine
	writeln(a.store); // prints 40
}


More information about the Digitalmars-d mailing list