On Sun, Jan 11, 2026 at 1:21 PM Jonathan Wakely wrote:
>
> std::is_specialization_of is unlikely to happen until it can handle
> non-type template parameters, and our __is_specialization_of
> won't be compatible with it.
I have implemented "std::is_specialization_of" for the GNU g++ compiler.
First I made a built-in function called "__is_specialization_of".
After I got this working, I had to define the standard library
template "std::is_specialization_of" inside libstdc++, and I did so as
follows:
template< typename T, template<typename...> class
__any_template_template_parameter >
constexpr bool is_specialization_of = __is_specialization_of(T,
__any_template_template_parameter);
In the compiler front-end (or back-end, I'm not sure which is which,
or which one is located in "gcc/cp"), I give special treatment to any
parameter named '__any_template_template_parameter'. For parameters
with this name, any template template parameter will be accepted, even
"std::array" which has a constant instead of a type.
Here is the patch:
https://github.com/healytpk/gcc-thomas-healy/commit/tag_is_specialization_of
And here it is tested and working:
https://godbolt.org/z/oWsq1nKs5