struct dont_care { dont_care(...); }; struct A {}; struct B { B(const A&) {} }; struct C { #ifdef USE_TEMPLATE template < typename T > static void f(const T&) {} #else static void f(const B&) {} #endif static void f(dont_care) {} }; int main() { C::f(A()); }