| 1 |
// PR c++/113788 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
struct S { int a, b; }; |
| 5 |
struct U { |
| 6 |
void foo () { this int g = 1; } // { dg-error "expected ';' before 'int'" } |
| 7 |
}; |
| 8 |
this auto h = 1; // { dg-error "expected unqualified-id before 'this'" } |
| 9 |
|
| 10 |
int |
| 11 |
main () |
| 12 |
{ |
| 13 |
S s = { 1, 2 }; |
| 14 |
short t[3] = { 3, 4, 5 }; |
| 15 |
this auto &[a, b] = s; // { dg-error "invalid use of 'this' in non-member function" } |
| 16 |
this auto &[c, d, e] = t; // { dg-error "invalid use of 'this' in non-member function" } |
| 17 |
this int f = 1; // { dg-error "invalid use of 'this' in non-member function" } |
| 18 |
for (this auto &i : t) // { dg-error "invalid use of 'this' in non-member function" } |
| 19 |
; // { dg-error "expected" } |
| 20 |
} // { dg-error "expected" } |