C++ Logo

std-discussion

Advanced search

Partial ordering of function template which have a place holder for deduced class type in the template parameter list.

From: Olivier Kannengieser <okannen_at_[hidden]>
Date: Tue, 28 Jul 2020 13:55:31 +0200
 thought that this code should compile under C++20:

    template <class> struct A {};
    template <class, A> struct B {};
    template <A x> struct B <int, x> {};

But it does not compile with GCC-10, and the error seems to happen during
partial ordering of function templates. I believe GCC follows the standard
at the letter.

I think that the problem is that synthesized argument for partial ordering
of function templates does not takes into account the case above
[temp.func.order]:

> To produce the transformed template, for each type, non-type, or
template template parameter (including template parameter packs
<http://eel.is/c++draft/temp.variadic#def:template_parameter_pack> thereof)
synthesize a unique type, value, or class template respectively and
substitute it for each occurrence of that parameter in the function type of
the template. <http://eel.is/c++draft/temp.func.order#3.sentence-1>

It is not said that in the case of a non type template-parameter when a
placeholder for a deduced class type is used in the type-specifier, the
type of the synthetized argument should be an unspecified specialization of
the template designated by the placeholder's template-name.

Received on 2020-07-28 06:59:02