Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/overload/template6.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// { dg-do compile { target c++11 } } template <typename> struct is_function { static constexpr bool value = false; }; template <typename R, typename ...Args> struct is_function<R(Args...)> { static constexpr bool value = true; }; template<bool, typename> struct enable_if {}; template<typename T> struct enable_if<true, T> { typedef T type; }; template <class T> struct remove_pointer { typedef T type; }; template <class T> struct remove_pointer<T*> { typedef T type; }; void f(int) {} void f(double) {} template <class T> struct X { template <class U=T, typename enable_if<is_function< typename remove_pointer<U>::type>::value, bool>::type = false> X(U&&) {} }; int main() { X<void(*)(int)> x0(f); }