1 // PR c++/58435 2 // { dg-do compile { target c++11 } } 3 4 template<typename T, typename U> 5 struct same { static const bool value = false; }; 6 template<typename T> 7 struct same<T, T> { static const bool value = true; }; 8 9 template <template <typename> class F, typename T> struct apply 10 { typedef F<T> type; }; 11 template <template <typename> class F, typename T> struct applyc 12 { typedef const F<T> type; }; 13 template <template <typename> class F, typename T> struct applyv 14 { typedef volatile F<T> type; }; 15 template <template <typename> class F, typename T> struct applycv 16 { typedef const volatile F<T> type; }; 17 18 template <typename T> using map = T; 19 template <typename T> using mapc = const T; 20 template <typename T> using mapv = volatile T; 21 template <typename T> using mapcv = const volatile T; 22 23 static_assert(same<apply<map, int>::type, int>::value, ""); 24 static_assert(same<apply<mapc, int>::type, const int>::value, ""); 25 static_assert(same<apply<mapv, int>::type, volatile int>::value, ""); 26 static_assert(same<apply<mapcv, int>::type, const volatile int>::value, ""); 27 28 static_assert(same<applyc<map, int>::type, const int>::value, ""); 29 static_assert(same<applyc<mapc, int>::type, const int>::value, ""); 30 static_assert(same<applyc<mapv, int>::type, const volatile int>::value, ""); 31 static_assert(same<applyc<mapcv, int>::type, const volatile int>::value, ""); 32 33 static_assert(same<applyv<map, int>::type, volatile int>::value, ""); 34 static_assert(same<applyv<mapc, int>::type, const volatile int>::value, ""); 35 static_assert(same<applyv<mapv, int>::type, volatile int>::value, ""); 36 static_assert(same<applyv<mapcv, int>::type, const volatile int>::value, ""); 37 38 static_assert(same<applycv<map, int>::type, const volatile int>::value, ""); 39 static_assert(same<applycv<mapc, int>::type, const volatile int>::value, ""); 40 static_assert(same<applycv<mapv, int>::type, const volatile int>::value, ""); 41 static_assert(same<applycv<mapcv, int>::type, const volatile int>::value, ""); 42