aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-explicit-spec7.C
blob: 9452159faf77cf83428be93a144c978fe50d1a9c (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++/107522
// { dg-do compile { target c++20 } }

template<class T>
struct A {
  template<int N>
  static void f() requires (N == 42);

  template<class U>
  struct B {
    template<int N>
    static void g() requires (T(N) == 42);
  };
};

template<>
template<int N>
void A<int>::f() requires (N == 42) { }

template<>
template<>
template<int N>
void A<int>::B<int>::g() requires (int(N) == 42) { }

int main() {
  A<int>::f<42>();
  A<int>::f<43>(); // { dg-error "no match" }
  A<int>::B<int>::g<42>();
  A<int>::B<int>::g<43>(); // { dg-error "no match" }
}