Title
Cv-qualification in deduction of reference to array
Status
drafting
Section
13.10.3.5 [temp.deduct.partial]
Submitter
Richard Smith

Created on 2013-01-28.00:00:00 last changed 141 months ago

Messages

Date: 2013-04-15.00:00:00

Notes from the April, 2013 meeting:

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

Date: 2013-01-28.00:00:00

Given

   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 13.10.3.5 [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.

History
Date User Action Args
2013-05-03 00:00:00adminsetmessages: + msg4351
2013-05-03 00:00:00adminsetstatus: open -> drafting
2013-01-28 00:00:00admincreate