Title
Deducing reference non-type template arguments
Status
cd4
Section
13.10.3.6 [temp.deduct.type]
Submitter
Richard Smith

Created on 2015-03-05.00:00:00 last changed 49 months ago

Messages

Date: 2016-03-15.00:00:00

Proposed resolution (March, 2016):

Change 13.10.3.6 [temp.deduct.type] paragraph 17 as follows:

If P has a form that contains <i>, and if the type of the corresponding value of A differs from the type of i differs from the type of the corresponding template parameter of the template named by the enclosing simple-template-id, deduction fails. If P has a form that contains [i]...
Date: 2016-06-15.00:00:00

[Adopted at the June, 2016 meeting.]

According to 13.10.3.6 [temp.deduct.type] paragraph 17,

If P has a form that contains <i>, and if the type of the corresponding value of A differs from the type of i, deduction fails.

This gives the wrong result for an example like:

  template<int &> struct X;
  template<int &N> void f(X<N>&);
  int n;
  void g(X<n> &x) { f(x); }

Here, P is X<N>, which contains <i>. The type of i is int&. The corresponding value from A is n, which is a glvalue of type int. Presumably this should be valid.

I think this rule means to say something like,

If P has a form that contains <i>, and the type of i differs from the type of the corresponding template parameter of the template named by the enclosing simple-template-id, deduction fails.
History
Date User Action Args
2017-02-06 00:00:00adminsetmessages: + msg6108
2017-02-06 00:00:00adminsetstatus: open -> cd4
2015-03-05 00:00:00admincreate