This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


1179. Cv-qualification of non-type template parameters

Section: 13.2  [temp.param]     Status: NAD     Submitter: Daniel Krügler     Date: 2010-08-19

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.)

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.