Actually, the bug is not really a problem with static arrays. The problem is just that is() isn't resolving aliases. If you replace 'size_t' with 'int' or 'uint', it works fine.
BTW the original code no longer works, since literals are now dynamic arrays, not static arrays.
--------
template IsStaticSmart(T) {
static if (is( T E : E[S], int S))
enum IsStaticSmart = "true: " ~ E.stringof;
else
enum IsStaticSmart = "false";
}
alias int AliasInt;
template IsStaticSmart2(T) {
static if (is( T E : E[S], AliasInt S))
enum IsStaticSmart2 = "true: " ~ E.stringof;
else
enum IsStaticSmart2 = "false";
}
char [3] z;
pragma(msg, IsStaticSmart!(typeof(z)));
pragma(msg, IsStaticSmart2!(typeof(z)));
DMD2.028 displays:
true: char
false
Comment #2 by yebblies — 2011-07-12T01:31:22Z
*** Issue 5830 has been marked as a duplicate of this issue. ***