Debian Codegraph @

gcc/testsuite/g++.dg/cpp23/auto-fncast5.C

raw
1 // PR c++/103049
2 // P0849R8 - auto(x)
3 // { dg-do compile { target c++23 } }
4
5 struct X {
6 X() = default;
7 X(const X&) = delete;
8 };
9
10 void
11 g ()
12 {
13 X x;
14 +X(x); // { dg-error "use of deleted function" }
15 +auto(x); // { dg-error "use of deleted function" }
16 }
17
18 class A;
19 void f(A);
20
21 class A {
22 int x;
23
24 public:
25 A();
26
27 auto run() {
28 f(A(*this));
29 f(auto(*this));
30 }
31
32 protected:
33 A(const A&);
34 };
35
36 void z () {
37 A a;
38 a.run ();
39 }