Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/concepts-this1.C

raw
1 // PR c++/103198
2 // { dg-do compile { target c++20 } }
3
4 template<class T, class = void>
5 struct A {
6 T val;
7
8 template<class U>
9 requires requires { val.x; }
10 void f(U);
11
12 static void g(int)
13 requires requires { val.x; };
14
15 void h(int)
16 requires requires { val.x; };
17 };
18
19 struct B { int x; };
20 struct C { };
21
22 int main() {
23 A<B>().f(0);
24 A<B>().g(0);
25 A<B>().h(0);
26
27 A<C>().f(0); // { dg-error "no match" }
28 A<C>().g(0); // { dg-error "no match" }
29 A<C>().h(0); // { dg-error "no match" }
30 }