| 1 |
// PR c++/52830 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-additional-options "-fchecking" } |
| 4 |
|
| 5 |
template<bool b> struct eif { typedef void type; }; |
| 6 |
template<> struct eif<false> {}; |
| 7 |
|
| 8 |
template<class A, class B> struct same |
| 9 |
{ |
| 10 |
static constexpr bool value = false; |
| 11 |
}; |
| 12 |
template<class A> |
| 13 |
struct same<A, A> |
| 14 |
{ |
| 15 |
static constexpr bool value = true; |
| 16 |
}; |
| 17 |
|
| 18 |
|
| 19 |
struct foo { |
| 20 |
template<class T> |
| 21 |
void func(T && a, |
| 22 |
typename eif<same<decltype(a), int&&>::value>::type * = 0); |
| 23 |
}; |
| 24 |
|
| 25 |
template<class T> |
| 26 |
void |
| 27 |
foo:: |
| 28 |
func(T && a, |
| 29 |
typename eif<same<decltype(a), int&&>::value>::type * ) |
| 30 |
{ |
| 31 |
} |
| 32 |
|
| 33 |
void do_stuff() |
| 34 |
{ |
| 35 |
foo f; |
| 36 |
f.func(12); |
| 37 |
} |