1 // { dg-do compile { target c++11 } } 2 3 template <typename> 4 struct is_function { 5 static constexpr bool value = false; 6 }; 7 8 template <typename R, typename ...Args> 9 struct is_function<R(Args...)> 10 { 11 static constexpr bool value = true; 12 }; 13 14 template<bool, typename> struct enable_if {}; 15 16 template<typename T> struct enable_if<true, T> 17 { 18 typedef T type; 19 }; 20 21 template <class T> 22 struct remove_pointer 23 { 24 typedef T type; 25 }; 26 27 template <class T> 28 struct remove_pointer<T*> 29 { 30 typedef T type; 31 }; 32 33 void f(int) {} 34 void f(double) {} 35 36 template <class T> 37 struct X 38 { 39 template <class U=T, 40 typename enable_if<is_function< 41 typename remove_pointer<U>::type>::value, 42 bool>::type = false> X(U&&) {} 43 }; 44 45 int main() { 46 X<void(*)(int)> x0(f); 47 } 48