Eponymous template with full template syntax
Steven Schveighoffer
schveiguy at yahoo.com
Mon Jul 1 13:21:48 PDT 2013
On Mon, 01 Jul 2013 14:15:04 -0400, Ali Çehreli <acehreli at yahoo.com> wrote:
> I think main's second line used to work:
>
> template isSmall(T)
> {
> enum isSmall = (T.sizeof < 12345);
> }
>
> void main()
> {
> static assert(isSmall!int); // <-- the usual syntax works
>
> static assert(isSmall!int.isSmall); // <-- compilation ERROR
> }
>
> Error: template deneme.isSmall does not match any function template
> declaration. Candidates are:
> deneme.isSmall(T)
> Error: template deneme.isSmall(T) cannot deduce template function from
> argument types !()(bool)
>
> Am I imagining it? I don't have a problem with it. :) Was the change
> intentional?
I think it used to work, and I think the change was intentional. I also
"discovered" this not too long ago.
-Steve
More information about the Digitalmars-d-learn
mailing list