Why does this template constraint not work?

Ross Hays accounts at rosshays.net
Fri Dec 27 18:26:41 PST 2013


import std.stdio;

void test(T)()
	if (is (T : float))
{
	writeln(typeid(T));
}

void main()
{
	test!int;
}

When I run this I am getting the output "int"
My understanding of template constraints is that the call to 
test!int will not find a match since the function test only 
accepts float as a template parameter. I just ran into this 
problem while trying to understand something unrelated.


More information about the Digitalmars-d-learn mailing list