summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-spec2.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-template-parm11.C20
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-spec2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-spec2.C
new file mode 100644
index 00000000000..4de07352c27
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-spec2.C
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++20 } }
+
+template<class T, int> concept C = true;
+
+template<class T> struct A {
+ template<C<sizeof(T)> U> void f(); // #1
+ template<C<0> U> void f(); // #2
+ template<C<-1> U> void f(); // #3
+};
+
+constexpr int n = sizeof(int);
+template<> template<C<n> U> void A<int>::f() { } // matches #1
+template<> template<C<0> U> void A<int>::f() { } // matches #2
+template<> template<C<-2> U> void A<int>::f() { } // no match { dg-error "match" }
+template<> template<class U> void A<int>::f() requires C<U, -1> { } // shouldn't match #3
+// { dg-error "match" "" { xfail *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-template-parm11.C b/gcc/testsuite/g++.dg/cpp2a/concepts-template-parm11.C
new file mode 100644
index 00000000000..498e3c175cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-template-parm11.C
@@ -0,0 +1,20 @@
+// PR c++/100374
+// { dg-do compile { target c++20 } }
+
+template<class T, class U>
+concept C = requires { typename T; };
+
+template<class T>
+struct A {
+ template<C<typename T::value_type> U>
+ void f();
+
+ template<C<typename T::value_type> U>
+ struct B;
+};
+
+int main() {
+ A<int> a;
+ a.f<void>();
+ using type = A<int>::B<void>;
+}