Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/concepts-explicit-spec7.C

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