http://d.puremagic.com/issues/show_bug.cgi?id=2355


clugd...@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|is() fails to recognize a   |is() doesn't resolve aliases
                   |static array                |before template matching




------- Comment #1 from clugd...@yahoo.com.au  2009-04-08 08:00 -------
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


-- 

Reply via email to