Title
Unnecessary restrictions on partial specializations
Status
nad
Section
17.6.5 [temp.class.spec]
Submitter
Jeremiah Wilcox

Created on 2012-10-19.00:00:00 last changed 63 months ago

Messages

Date: 2015-04-13.00:00:00

Additional note, April, 2015:

EWG has decided not to make a change in this area. See EWG issue 110.

Date: 2013-04-15.00:00:00

Rationale (April, 2013)

CWG felt that consideration of these suggestions was more appropriately done by EWG.

Date: 2012-10-19.00:00:00

One of the restrictions on partial specializations found in 17.6.5 [temp.class.spec] paragraph 8 is:

The template parameter list of a specialization shall not contain default template argument values. [Footnote: There is no way in which they could be used. —end footnote]

The rationale for this restriction is incorrect, since default template argument values can be used to trigger SFINAE and thus control whether a particular partial specialization is used. An example of this use is:

    template <typename T> struct a;
    template <typename T,
         typename = typename std::enable_if<some property>::type>
    struct a<std::vector<T>> { ... };

which is forbidden by this point. Note also that an example like

    template <typename T> struct b;
    template <typename T,
         typename = typename std::enable_if<some property>::type>
    struct b<T> { ... };

is likely forbidden by the previous bullet:

The argument list of the specialization shall not be identical to the implicit argument list of the primary template.

This restriction may also need to be weakened.

History
Date User Action Args
2015-04-13 00:00:00adminsetmessages: + msg5436
2015-04-13 00:00:00adminsetstatus: extension -> nad
2013-05-03 00:00:00adminsetmessages: + msg4451
2013-05-03 00:00:00adminsetstatus: open -> extension
2012-10-19 00:00:00admincreate