| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
template<typename T, typename U> struct same_type; |
| 3 |
template<typename T> struct same_type<T, T> {}; |
| 4 |
|
| 5 |
int lval_int; |
| 6 |
int rval_int(); |
| 7 |
int const lval_const_int=0; |
| 8 |
int const&& rval_const_int(); |
| 9 |
|
| 10 |
template <typename T> void deduce_lval_int(T && t) |
| 11 |
{ |
| 12 |
same_type<T, int &>(); |
| 13 |
} |
| 14 |
|
| 15 |
template <typename T> void deduce_rval_int(T && t) |
| 16 |
{ |
| 17 |
same_type<T, int>(); |
| 18 |
} |
| 19 |
|
| 20 |
template <typename T> void deduce_lval_const_int(T && t) |
| 21 |
{ |
| 22 |
same_type<T, const int &>(); |
| 23 |
} |
| 24 |
|
| 25 |
template <typename T> void deduce_rval_const_int(T && t) |
| 26 |
{ |
| 27 |
same_type<T, const int>(); |
| 28 |
} |
| 29 |
|
| 30 |
void f() |
| 31 |
{ |
| 32 |
deduce_lval_int(lval_int); |
| 33 |
deduce_rval_int(rval_int()); |
| 34 |
deduce_lval_const_int(lval_const_int); |
| 35 |
deduce_rval_const_int(rval_const_int()); |
| 36 |
} |