| 1 |
// PR c++/41815 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-fno-ipa-icf" } |
| 4 |
|
| 5 |
template<typename T, typename U> struct same_type; |
| 6 |
template<typename T> struct same_type<T, T> {}; |
| 7 |
|
| 8 |
int const f() { return 0; } |
| 9 |
|
| 10 |
int &&r = f(); // binding "int&&" to "int" should succeed |
| 11 |
same_type<decltype(f()), int> s1; |
| 12 |
same_type<decltype(0,f()), int> s2; |
| 13 |
|
| 14 |
template <class T> |
| 15 |
T const g() { return 0; } |
| 16 |
|
| 17 |
int &&r2 = g<int>(); |
| 18 |
same_type<decltype(g<int>()), int> s3; |
| 19 |
same_type<decltype(0,g<int>()), int> s4; |