1 // { dg-do compile { target c++11 } }
3 enum E1 : unsigned { E1_en = 1 };
4 enum E2 : char { E2_en = 1 };
5 enum class E3 { a = -1 };
6 enum class E4 : unsigned char { c = 1 };
7 enum class E5 : int { a = -1, b = 1 };
8 enum class E6 : long { c = __LONG_MAX__ };
10 template<typename T1, typename T2>
12 { static const bool value = false; };
16 { static const bool value = true; };
19 struct underlying_type;
21 template<typename T, typename U>
23 test(T, U, typename underlying_type<T>::type);
26 struct underlying_type
27 { typedef __underlying_type(T) type; };
29 template<typename T, typename U>
31 test(T, U, typename underlying_type<T>::type)
33 static_assert(is_same<typename underlying_type<T>::type, U>::value,
39 test(E1::E1_en, unsigned(), 1);
40 test(E2::E2_en, char(), 1);
41 test(E3::a, int(), -1);
42 test(E4::c, (unsigned char)(1), 1);
43 test(E5::a, int(), -1);
44 test(E6::c, long(), __LONG_MAX__);