CTFE and structs question

g g at g-desktop.com
Sun Nov 8 08:11:32 PST 2009


Don Wrote:

> 
> You can do stuff like:
> 
> struct Foo {
>     int x;
> }
> 
> enum Foo b = Foo(56);

strange. you can do that only if there is no constructor.

Also trying with templates, i got a segfault, i dont know if it is already reported.
Why this segfaults?. At least it should print a error message.

enum Move b = genMove!();
struct Move{
	int Dx;
    }
template genMove(){
    enum invariant(Move) genMove = { Dx:4};
}

it just segfaults:

/Documentos/NCHESS$ dmd pi
Fallo de segmentación
/Documentos/NCHESS$




More information about the Digitalmars-d-learn mailing list