This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


1610. Cv-qualification in deduction of reference to array

Section:  [temp.deduct.partial]     Status: drafting     Submitter: Richard Smith     Date: 2013-01-28


   template<class C> void foo(const C* val) {}
   template<int N> void foo(const char (&t)[N]) {}

it is intuitive that the second template is more specialized than the first. However, the current rules make them unordered. In [temp.deduct.partial] paragraph 4, we have P as const C* and A as const char (&)[N]. Paragraph 5 transforms A to const char[N]. Finally, paragraph 7 removes top-level cv-qualification; since a cv-qualified array element type is considered to be cv-qualification of the array (6.8.5 [basic.type.qualifier] paragraph 5, cf issue 1059), A becomes char[N]. P remains const C*, so deduction fails because of the missing const in A.

Notes from the April, 2013 meeting:

CWG agreed that the const should be preserved in the array type.