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.
This commit is contained in:
Patrick Palka 2022-01-20 13:12:16 -05:00
parent 5c12507f5d
commit 2f34d7ef3d

View File

@ -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" }
}