[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / ext / underlying_type6.C
blob91be4d5d994f3972d349614b4c6103738b5ef653
1 // { dg-do compile { target c++11 } }
3 template<typename T1, typename T2>
4   struct is_same
5   { static const bool value = false; };
7 template<typename T>
8   struct is_same<T, T>
9   { static const bool value = true; };
11 enum E1 : unsigned { };
12 enum E2 : char { };
13 enum class E3 { };
14 enum class E4 : unsigned char { c = 1 };
15 enum class E5 : int { a = -1, b = 1 };
16 enum class E6 : long { c = __LONG_MAX__ };
18 template<typename T, typename U,
19          typename V = __underlying_type(T)>
20   struct test
21   {
22     static_assert(is_same<U, V>::value, "Error");
23   };
25 template class test<E1, unsigned>;
26 template class test<E2, char>;
27 template class test<E3, int>;
28 template class test<E4, unsigned char>;
29 template class test<E5, int>;
30 template class test<E6, long>;