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