summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/partial12.C
blob: 05a3eca97be46ea623905a3da7d98e3809b91312 (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
25
26
27
// PR c++/46105

template< typename T >
struct empty { // support class is like stripped-down enable_if
    typedef void type;
};

template< class T, typename v = void > // v is always void!
struct element {
    typedef typename T::value_type type;
};

template< class T > // T in deduced context, T::element_type is SFINAE:
struct element< T, typename empty< typename T::element_type >::type > {
    typedef typename T::element_type type;
};

template< class T >
struct element< T const, typename empty< typename T::element_type >::type > {
    typedef typename T::element_type const type;
};

struct has_et {
    typedef int element_type;
};

element<has_et const>::type ip = 0;