CWG Issue 2091 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-05
2091. Deducing reference non-type template arguments
Section: 13.10.3.6 [temp.deduct.type]Status: CD4Submitter: Richard SmithDate: 2015-03-05
[Adopted at the June, 2016 meeting.]
According to 13.10.3.6 [temp.deduct.type] paragraph 17,
If P has a form that contains , and if the type of the corresponding value of Adiffers 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&); int n; void g(X &x) { f(x); }
Here, P is X, which contains. 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 , 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.
Proposed resolution (March, 2016):
Change 13.10.3.6 [temp.deduct.type] paragraph 17 as follows:
If P has a form that contains , and if the type of
the corresponding value of A differs from the type ofi 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]...