aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-this1.C
blob: d717028201a1c5b8dbfd2ade6497aea385657b38 (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
// PR c++/103198
// { dg-do compile { target c++20 } }

template<class T, class = void>
struct A {
  T val;

  template<class U>
    requires requires { val.x; }
  void f(U);

  static void g(int)
    requires requires { val.x; };

  void h(int)
    requires requires { val.x; };
};

struct B { int x; };
struct C { };

int main() {
  A<B>().f(0);
  A<B>().g(0);
  A<B>().h(0);

  A<C>().f(0); // { dg-error "no match" }
  A<C>().g(0); // { dg-error "no match" }
  A<C>().h(0); // { dg-error "no match" }
}