| 1 |
// PR c++/54359 |
| 2 |
// { dg-require-effective-target c++11 } |
| 3 |
|
| 4 |
int& ref(int& x) { return x; } |
| 5 |
const int& ref(const int& x) { return x; } |
| 6 |
|
| 7 |
class A { |
| 8 |
int x; |
| 9 |
int f() const; |
| 10 |
auto test1() const -> decltype(this); |
| 11 |
auto test2() const -> decltype(ref(x)); |
| 12 |
auto test3() const -> decltype(f()); |
| 13 |
}; |
| 14 |
|
| 15 |
auto A::test1() const -> decltype(this) { |
| 16 |
return this; |
| 17 |
} |
| 18 |
|
| 19 |
auto A::test2() const -> decltype(ref(x)) { |
| 20 |
return ref(x); |
| 21 |
} |
| 22 |
|
| 23 |
auto A::test3() const -> decltype(f()) { |
| 24 |
return f(); |
| 25 |
} |