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:
parent
5c12507f5d
commit
2f34d7ef3d
26
gcc/testsuite/g++.dg/cpp2a/nontype-class51.C
Normal file
26
gcc/testsuite/g++.dg/cpp2a/nontype-class51.C
Normal 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" }
|
||||
}
|
Loading…
Reference in New Issue
Block a user