icpc fails: template and function pointer

icpc fails: template and function pointer

#include

typedef int (*functionpointer)();

template
int print()
{
T a=(T) 3.14159;
std::cout << "print() called, a=" << a << "
";
return 0;
}

template
int runfunction()
{
return f();
}

template void program(const T &pi)
{
std::cout << "program called: pi=" << pi <<"
";

// OK with gcc + icc
//runfunction< &print >();

// only OK for gcc
runfunction< &print >();
}

main()
{
program(3.14159);
}

THis compiles with g++ -ansi but not with icpc ver 10.X why ?

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.