111
|
1 // { dg-do compile { target c++11 } }
|
|
2
|
|
3 template<typename T1, typename T2>
|
|
4 struct is_same
|
|
5 { static const bool value = false; };
|
|
6
|
|
7 template<typename T>
|
|
8 struct is_same<T, T>
|
|
9 { static const bool value = true; };
|
|
10
|
|
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__ };
|
|
17
|
|
18 template<typename T, typename U>
|
|
19 struct test
|
|
20 {
|
|
21 static_assert(is_same<T, U>::value, "Error");
|
|
22 };
|
|
23
|
|
24 test<__underlying_type(E1), unsigned> t1;
|
|
25 test<__underlying_type(E2), char> t2;
|
|
26 test<__underlying_type(E3), int> t3;
|
|
27 test<__underlying_type(E4), unsigned char> t4;
|
|
28 test<__underlying_type(E5), int> t5;
|
|
29 test<__underlying_type(E6), long> t6;
|