diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-01-20 13:12:16 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-01-20 13:12:16 -0500 |
commit | 2f34d7ef3d026cf7109b6e6bb2eca14c840e7c71 (patch) | |
tree | ef9b4b20f67941b493ffdb3fa8688a1bbcd33776 | |
parent | 5c12507f5d0bc080e4f346af99824e039236e61c (diff) | |
download | gcc-2f34d7ef3d026cf7109b6e6bb2eca14c840e7c71.zip gcc-2f34d7ef3d026cf7109b6e6bb2eca14c840e7c71.tar.gz gcc-2f34d7ef3d026cf7109b6e6bb2eca14c840e7c71.tar.bz2 |
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.
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/nontype-class51.C | 26 |
1 files changed, 26 insertions, 0 deletions
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 0000000..1501aa1 --- /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 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" } +} |