Title
Cv-qualification of non-type template parameters
Status
nad
Section
13.2 [temp.param]
Submitter
Daniel Krügler

Created on 2010-08-19.00:00:00 last changed 163 months ago

Messages

Date: 2010-11-15.00:00:00

Rationale (November, 2010):

As noted, the treatment of cv-qualification of the type of non-type template parameters is irrelevant because they are currently always non-class prvalues. If the language is extended to allow literal class types, a change to the handling of cv-qualification would be upwardly compatible, so nothing needs to be done now.

Date: 2022-11-20.07:54:16

Given an example like

    template<const int I> struct S {
        decltype(I) m;
    };

what is the type of m? 13.2 [temp.param] paragraph 5 is clear on the question:

The top-level cv-qualifiers on the template-parameter are ignored when determining its type.

It's not clear that this is the desired outcome, however, particularly in light of the resolution of issue 1130. (This does not make any difference for the current language, as a non-type template parameter is a prvalue and non-class prvalues are never cv-qualified. It would have an impact, however, if a future revision of the language were to allow literal class types as non-type template parameters, so if a change is needed, it might be a good idea to do it now.)

History
Date User Action Args
2010-11-29 00:00:00adminsetmessages: + msg3220
2010-11-29 00:00:00adminsetstatus: open -> nad
2010-08-19 00:00:00admincreate