aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/explicit-obj-by-value4.C
blob: 9b4e00582cfbaa964272026a1aa10603eeff56fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// P0847R7
// { dg-do compile { target c++23 } }

// diagnosis of ill-formed calls to by-value xobj member functions
// due to an absence of valid conversion functions

struct NotFromS {};

struct S {
  void f(this int) {}
  void g(this NotFromS) {}
};

void test()
{
  S s{};
  s.f(); // { dg-error {cannot convert 'S' to 'int'} }
  s.g(); // { dg-error {cannot convert 'S' to 'NotFromS'} }
}