Debian Codegraph @

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

raw
1 // Verify we don't crash when matching constraints containing a
2 // TEMPLATE_ID_EXPR that names a template from the current instantiation.
3 // { dg-do compile { target c++20 } }
4
5 template<class T> static constexpr bool False = false;
6
7 template<class T>
8 struct A {
9 template<int N> static constexpr bool C = sizeof(T) > N;
10 friend constexpr void f(A) requires C<1> { }
11 friend constexpr void f(A) requires C<1> && False<T> { }
12 };
13
14 template<class T>
15 struct A<T*> {
16 template<int N> static constexpr bool D = sizeof(T) > N;
17 friend constexpr void g(A) requires D<1> { }
18 friend constexpr void g(A) requires D<1> && False<T> { }
19 };
20
21 int main() {
22 f(A<int>{});
23 g(A<int*>{});
24 }