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

Zhenya zheny at list.ru
Tue Aug 7 00:51:35 PDT 2012


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
}


More information about the Digitalmars-d-learn mailing list