summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/enum37.C
blob: b67720d5ea028f06d9fb3960120d5a10f56653cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// PR c++/89024
// { dg-do compile { target c++11 } }

template <class T, class U> struct same;
template <class T> struct same<T,T> {};

template<class T> T&& declval();

template<typename _To1>
void __test_aux(_To1);

template<typename _From1, typename _To1,
        typename = decltype(__test_aux<_To1>(declval<_From1>()))>
char __test(int);

template<typename, typename>
int __test(...);

enum E {
    x = decltype(__test<E, int>(0))(0)
};

same<E,decltype(x)> s;
same<unsigned int,__underlying_type(E)> s2; // { dg-error "incomplete type" "" { target short_enums } }