wg21.cmeerw.net

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

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.

History Date User Action Args 2014-03-03 00:00:00adminsetstatus: fdis -> c++11 2011-04-10 00:00:00adminsetstatus: dr -> fdis 2010-11-29 00:00:00adminsetmessages: + msg3197 2010-11-29 00:00:00adminsetstatus: tentatively ready -> dr 2010-10-18 00:00:00adminsetmessages: + msg2993 2010-10-18 00:00:00adminsetstatus: drafting -> tentatively ready 2010-08-23 00:00:00adminsetstatus: open -> drafting 2010-01-31 00:00:00admincreate

Read the original on wg21.cmeerw.net ↗