]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: add testcase for recently fixed PR [PR103631]
authorPatrick Palka <ppalka@redhat.com>
Thu, 20 Jan 2022 18:12:16 +0000 (13:12 -0500)
committerPatrick Palka <ppalka@redhat.com>
Thu, 20 Jan 2022 18:12:16 +0000 (13:12 -0500)
We accept this testcase after r12-6773.

PR c++/103631

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-class51.C: New test.

gcc/testsuite/g++.dg/cpp2a/nontype-class51.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class51.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class51.C
new file mode 100644 (file)
index 0000000..1501aa1
--- /dev/null
@@ -0,0 +1,26 @@
+// PR c++/103631
+// { dg-do compile { target c++20 } }
+
+template<class Target, template<auto> class T>
+constexpr bool is_specialize_value_v = false;
+
+template<template<auto> class T, auto Ts>
+constexpr bool is_specialize_value_v<T<Ts>, T> = true;
+
+template<class Target, template<auto> class T>
+concept specialize_value = is_specialize_value_v<Target, T>;
+
+template<int> struct Test { };
+
+template<Test>
+struct A {
+  template<class T> void f(T) requires specialize_value<T, A>;
+};
+
+int main() {
+  A<Test<0>{}> a0;
+  A<Test<1>{}> a1;
+  a0.f(a0);
+  a0.f(a1);
+  a0.f(0); // { dg-error "no match" }
+}