aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/decomp38.C
blob: fc69c02e4d39c45db5ba304021fe1f64755c82bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// { dg-additional-options -std=c++17 }
// { dg-do compile }

class X
{
   int a, b;
   void f()
   {
     auto[x,y] = *this;
   }
};

class X2
{
   int a, b;
   void f(X2& other)
   {
     auto[x,y] = other;
   }
};

struct X3
{
  friend void foo();
private:
  int a;
};

void foo()
{
  X3 x;
  auto [a] = x;
}

struct X4
{
  int a;
};

struct X5 : private X4
{
  friend void foo2();
};

void foo2() {
  X5 x;
  auto [a] = x;
}