This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-10-26
[Moved to DR at the September, 2013 meeting.]
According to 13.4.3 [temp.arg.nontype] paragraph 1, the argument for a non-type template parameter of pointer or reference type must be
a constant expression (7.7 [expr.const]) that designates the address of an object with static storage duration and external or internal linkage or a function with external or internal linkage, including function templates and function template-ids but excluding non-static class members, expressed (ignoring parentheses) as & id-expression, except that the & may be omitted if the name refers to a function or array and shall be omitted if the corresponding template-parameter is a reference
In C++03, the requirement for an id-expression eliminated the use of “addresses of array elements and names or addresses of non-static class members,” as noted in paragraph 3 of that section. With the advent of generalized constant expressions, however, it is possible to satisfy the requirements and still address these subobjects. For example:
extern constexpr int x[] = { 0, 1 }; constexpr const int *p1 = x + 1; const int &r = *p1; template <const int *> struct A; template <> struct A<&r> { };
If this is intentional, the note in 13.4.3 [temp.arg.nontype] paragraph 3 should be revised or removed; if not, the normative wording of paragraph 1 must be revised.
Notes from the April, 2013 meeting:
CWG did not favor extending the range of non-type template arguments to include subobjects, feeling that they should continue to be restricted to the address of a complete object.
Proposed resolution (June, 2013):
Change 13.4.3 [temp.arg.nontype] paragraph 1 as follows:
A template-argument for a non-type, non-template template-parameter shall be one of:
...
a constant expression (7.7 [expr.const]) that designates the address of
ana complete object with static storage duration and external or internal linkage or a function with external or internal linkage, including function templates and function template-ids but excluding non-static class members, expressed (ignoring parentheses) as & id-expression, where the id-expression is the name of an object or function, except that the & may be omitted if the name refers to a function or array and shall be omitted if the corresponding template-parameter is a reference; or...