> writeln(typeid(typeof(a.init))); // prints: int > ?! You mean typeof(a) != typeof((typeof(a)).init) ?!
Ugh... I thought (int[2]).init was [0,0] and in general (T[n]).init was [(T.init) n times] > writeln(foo(a)); // test.d(14): Error: Array operation s + s not > implemented > } > > > But now I don't know what's happening, because that trait correctly returns > false, but the compiler generates a compile error at line 14 still. I think > there's a new bug I think your bug is this discrepancy between init's type and the original type. That needs a bug report by itself; in a template constraint, any value is at its type .init value, not its runtype value (obvious in retrospect) In your example {return s+s;} becomes {return 0+0;}, since the compiler wrongly infer (int[2]).init to be 0, a regular int. And your __traits return true: auto bar(T)(T t) { return __traits(compiles, {return t+t;});} int[2] a; writeln(bar(a)); // true! Philippe