template < typename T>
void f( T a, T b) { }
float get_value( ) //consider this too!
{
return 1.0 ;
}
int main( )
{
f( get_value( ) , 1 ) ; //compilation error
f( get_value( ) , 1.0 ) ; //compilation error
f( get_value( ) , 1.0f ) ; //okay
}
CnRlbXBsYXRlPHR5cGVuYW1lIFQ+CnZvaWQgZihUIGEsIFQgYikge30KCmZsb2F0IGdldF92YWx1ZSgpIC8vY29uc2lkZXIgdGhpcyB0b28hCnsKCXJldHVybiAxLjA7Cn0KaW50IG1haW4oKQp7CglmKGdldF92YWx1ZSgpLCAxKTsgICAvL2NvbXBpbGF0aW9uIGVycm9yCglmKGdldF92YWx1ZSgpLCAxLjApOyAvL2NvbXBpbGF0aW9uIGVycm9yCglmKGdldF92YWx1ZSgpLCAxLjBmKTsgLy9va2F5CQp9Cg==
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:11: error: no matching function for call to ‘f(float, int)’
prog.cpp:12: error: no matching function for call to ‘f(float, double)’
stdout