icpc fails: template and function pointer

icpc fails: template and function pointer

Bild des Benutzers 24689753x@gmail.com

#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 Beitrag / 0 neu
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.