gcc/testsuite/g++.dg/cpp1z/decomp38.C
raw| 1 | // { dg-do compile { target c++17 } } |
| 2 | |
| 3 | class X |
| 4 | { |
| 5 | int a, b; |
| 6 | void f() |
| 7 | { |
| 8 | auto[x,y] = *this; |
| 9 | } |
| 10 | }; |
| 11 | |
| 12 | class X2 |
| 13 | { |
| 14 | int a, b; |
| 15 | void f(X2& other) |
| 16 | { |
| 17 | auto[x,y] = other; |
| 18 | } |
| 19 | }; |
| 20 | |
| 21 | struct X3 |
| 22 | { |
| 23 | friend void foo(); |
| 24 | private: |
| 25 | int a; |
| 26 | }; |
| 27 | |
| 28 | void foo() |
| 29 | { |
| 30 | X3 x; |
| 31 | auto [a] = x; |
| 32 | } |
| 33 | |
| 34 | struct X4 |
| 35 | { |
| 36 | int a; |
| 37 | }; |
| 38 | |
| 39 | struct X5 : private X4 |
| 40 | { |
| 41 | friend void foo2(); |
| 42 | }; |
| 43 | |
| 44 | void foo2() { |
| 45 | X5 x; |
| 46 | auto [a] = x; |
| 47 | } |