Debian Codegraph @

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

raw
1 // { dg-do compile { target c++20 } }
2
3 template<class T, int> concept C = true;
4
5 template<class T> struct A {
6 template<C<sizeof(T)> U> void f(); // #1
7 template<C<0> U> void f(); // #2
8 template<C<-1> U> void f(); // #3
9 };
10
11 constexpr int n = sizeof(int);
12 template<> template<C<n> U> void A<int>::f() { } // matches #1
13 template<> template<C<0> U> void A<int>::f() { } // matches #2
14 template<> template<C<-2> U> void A<int>::f() { } // no match { dg-error "match" }
15 template<> template<class U> void A<int>::f() requires C<U, -1> { } // shouldn't match #3
16 // { dg-error "match" "" { xfail *-*-* } .-1 }