]>
Commit | Line | Data |
---|---|---|
0e69fdf0 PC |
1 | // PR c++/51213 |
2 | // { dg-do compile { target c++11 } } | |
3 | ||
4 | class C { | |
5 | typedef int type; | |
6 | }; | |
7 | ||
742b0bcd JM |
8 | template<int> |
9 | struct I; | |
10 | ||
11 | template<> | |
12 | struct I<2> { }; | |
13 | ||
0e69fdf0 PC |
14 | template<class T, class = typename T::type> |
15 | auto f(int) -> char; | |
16 | ||
17 | template<class> | |
18 | auto f(...) -> char (&)[2]; | |
19 | ||
20 | static_assert(sizeof(f<C>(0)) == 2, "Ouch"); | |
21 | ||
742b0bcd JM |
22 | typedef int testf[sizeof(f<C>(0)) == 2 ? 1 : -1]; |
23 | ||
24 | I<sizeof(f<C>(0))> vf; | |
25 | ||
0e69fdf0 PC |
26 | template<class T> |
27 | auto g(int) -> decltype(typename T::type(), char()); | |
28 | ||
29 | template<class> | |
30 | auto g(...) -> char (&)[2]; | |
31 | ||
32 | static_assert(sizeof(g<C>(0)) == 2, "Ouch"); | |
742b0bcd JM |
33 | |
34 | typedef int testg[sizeof(g<C>(0)) == 2 ? 1 : -1]; | |
35 | ||
36 | I<sizeof(g<C>(0))> vg; |