From: Patrick Palka Date: Thu, 20 Jan 2022 18:12:16 +0000 (-0500) Subject: c++: add testcase for recently fixed PR [PR103631] X-Git-Tag: basepoints/gcc-13~1536 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f34d7ef3d026cf7109b6e6bb2eca14c840e7c71;p=thirdparty%2Fgcc.git c++: add testcase for recently fixed PR [PR103631] We accept this testcase after r12-6773. PR c++/103631 gcc/testsuite/ChangeLog: * g++.dg/cpp2a/nontype-class51.C: New test. --- diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class51.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class51.C new file mode 100644 index 000000000000..1501aa1c4268 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class51.C @@ -0,0 +1,26 @@ +// PR c++/103631 +// { dg-do compile { target c++20 } } + +template class T> +constexpr bool is_specialize_value_v = false; + +template class T, auto Ts> +constexpr bool is_specialize_value_v, T> = true; + +template class T> +concept specialize_value = is_specialize_value_v; + +template struct Test { }; + +template +struct A { + template void f(T) requires specialize_value; +}; + +int main() { + A{}> a0; + A{}> a1; + a0.f(a0); + a0.f(a1); + a0.f(0); // { dg-error "no match" } +}