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
[Voted into the WP at the November, 2010 meeting.]
The current wording of 13.4.3 [temp.arg.nontype] paragraph 1 does not prevent the use a reference as a non-type template argument. It simply requires
the address of an object or function with external linkage... expressed as & id-expression...
This would presumably (but unintentionally?) allow an example like the following:
struct S { }; template<S*> struct X { }; S s; S& ref = s; X<&ref> xr; // well-formed?
The expression &ref is not a constant expression, but the current wording of 13.4.3 [temp.arg.nontype] does not require a constant expression.
Proposed resolution (September, 2010):
Change 13.4.3 [temp.arg.nontype] bullet 1.3 as follows:
a constant expression (7.7 [expr.const]) that designates the address of an object or function with external 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; or