aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/auto-fncast5.C
blob: b29901ffea4d9bb58066638a0ef1ba067937c3c8 (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
// PR c++/103049
// P0849R8 - auto(x)
// { dg-do compile { target c++23 } }

struct X {
  X() = default;
  X(const X&) = delete;
};

void
g ()
{
  X x;
  +X(x); // { dg-error "use of deleted function" }
  +auto(x); // { dg-error "use of deleted function" }
}

class A;
void f(A);

class A {
    int x;

public:
    A();

    auto run() {
        f(A(*this));
        f(auto(*this));
    }

protected:
    A(const A&);
};

void z () {
  A a;
  a.run ();
}