Re: std.traits functions causing the compiler to crash

2013-06-11 Thread Regan Heath
On Sat, 08 Jun 2013 05:52:49 +0100, Eric wrote: On Saturday, 8 June 2013 at 02:32:57 UTC, bearophile wrote: Eric: Yes, the template constraint is much better. However, the compiler still crashes, even with the new code: Because there's a type definition loop, regardless. Using a constrai

Re: std.traits functions causing the compiler to crash

2013-06-07 Thread Eric
On Saturday, 8 June 2013 at 02:32:57 UTC, bearophile wrote: Eric: Yes, the template constraint is much better. However, the compiler still crashes, even with the new code: Because there's a type definition loop, regardless. Using a constraint doesn't change that situation. Bye, bearophile

Re: std.traits functions causing the compiler to crash

2013-06-07 Thread bearophile
Eric: Yes, the template constraint is much better. However, the compiler still crashes, even with the new code: Because there's a type definition loop, regardless. Using a constraint doesn't change that situation. Bye, bearophile

Re: std.traits functions causing the compiler to crash

2013-06-07 Thread Eric
O import std.traits: hasMember; interface Xidentity(V, K) if (!hasMember!(V, "x")) { } class Foo(K): Xidentity!(Foo!K, K) { K x; } void main() { new Foo!double; } I think it contains a loop at the level of types. In theory the compiler should catch them and give a nice error message.

Re: std.traits functions causing the compiler to crash

2013-06-07 Thread bearophile
Eric: Is this a known problem, or is there a work-around? This is your code reduced a little: import std.traits: hasMember; interface Xidentity(V, K) if (!hasMember!(V, "x")) { } class Foo(K): Xidentity!(Foo!K, K) { K x; } void main() { new Foo!double; } I think it contains a loop a

std.traits functions causing the compiler to crash

2013-06-07 Thread Eric
mport std.traits; interface Xidentity(V, K) { static if (hasMember!(V, "k")) static assert(0); public int getInstanceCount(); } class X(K) : Xidentity!(X!(K), K) { private K k; X newInstance(K k) { return(new X(k)); } private this(K k) { this.k = k; } public int getInst