std.traits functions causing the compiler to crash

bearophile bearophileHUGS at lycos.com
Fri Jun 7 13:27:04 PDT 2013


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 at the level of types. In theory the 
compiler should catch them and give a nice error message.

You probably want to use the template constraint syntax, as I 
have used.

In D return is not a function, so don't use the ( ).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list