Why __traits(compile,...) fails here?

David d at dav1d.de
Tue Aug 7 02:17:52 PDT 2012


Am 07.08.2012 09:51, schrieb Zhenya:
> import std.stdio;
>
> template isType(alias s)
> {
>      enum isType = !__traits(compiles,mixin("typeof(s)"));
> }
>
> void main()
> {
> //    writeln(isType!int);// Error: template instance isType!(int)
> isType!(int) does not match template declaration isType(alias s)
>      writeln(__traits(compiles,mixin("typeof(int)")));//write: false
> }

http://dpaste.dzfl.pl/bd54413f


More information about the Digitalmars-d-learn mailing list