2 // { dg-do compile { target c++11 } }
4 template<typename T, typename U>
5 struct same { static const bool value = false; };
7 struct same<T, T> { static const bool value = true; };
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; };
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;
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, "");
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, "");
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, "");
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, "");