Title
Which template does an explicit specialization specialize?
Status
nad
Section
13.10.3 [temp.deduct]
Submitter
Andrei Iltchenko

Created on 2001-07-07.00:00:00 last changed 38 months ago

Messages

Date: 2021-02-15.00:00:00

Rationale (February, 2021):

The missing specification was added by C++11; see 13.10.3.7 [temp.deduct.decl].

Date: 2022-11-20.07:54:16

Andrei Iltchenko points out that the standard has no wording that defines how to determine which template is specialized by an explicit specialization of a function template. He suggests "template argument deduction in such cases proceeds in the same way as when taking the address of a function template, which is described in 13.10.3.3 [temp.deduct.funcaddr]."

John Spicer points out that the same problem exists for all similar declarations, i.e., friend declarations and explicit instantiation directives. Finding a corresponding placement operator delete may have a similar problem.

John Spicer: There are two aspects of "determining which template" is referred to by a declaration: determining the function template associated with the named specialization, and determining the values of the template arguments of the specialization.

    template <class T> void f(T);  #1
    template <class T> void f(T*); #2
    template <> void f(int*);

In other words, which f is being specialized (#1 or #2)? And then, what are the deduced template arguments?

13.7.7.3 [temp.func.order] does say that partial ordering is done in contexts such as this. Is this sufficient, or do we need to say more about the selection of the function template to be selected?

13.10.3 [temp.deduct] probably needs a new section to cover argument deduction for cases like this.

History
Date User Action Args
2021-02-17 00:00:00adminsetmessages: + msg6515
2021-02-17 00:00:00adminsetstatus: open -> nad
2001-07-07 00:00:00admincreate