Title
Incorrect requirement for default arguments
Status
c++20
Section
12.2.3 [over.match.viable]
Submitter
S. B. Tam

Created on 2019-09-24.00:00:00 last changed 47 months ago

Messages

Date: 2019-10-15.00:00:00

Proposed resolution (October, 2019):

Change 12.2.3 [over.match.viable] bullet 2.3 as follows:

  • A candidate function having more than m parameters is viable only if the (m+1)st parameter has a default argument (9.3.4.7 [dcl.fct.default]). [Footnote: According to 9.3.4.7 [dcl.fct.default], parameters following the (m+1)st parameter must also have default arguments. —end footnote] all parameters following the mth have default arguments (9.3.4.7 [dcl.fct.default]). For the purposes of overload resolution, the parameter list is truncated on the right, so that there are exactly m parameters.

Date: 2019-11-15.00:00:00

[Adopted as a DR at the November, 2019 meeting.]

(From editorial issue 3235.)

According to 12.2.3 [over.match.viable] bullet 2.3 says,

First, to be a viable function, a candidate function shall have enough parameters to agree in number with the arguments in the list.

  • ...

  • A candidate function having more than m parameters is viable only if the (m+1)st parameter has a default argument (9.3.4.7 [dcl.fct.default]). [Footnote: According to 9.3.4.7 [dcl.fct.default], parameters following the (m+1)st parameter must also have default arguments. —end footnote] For the purposes of overload resolution, the parameter list is truncated on the right, so that there are exactly m parameters.

However, this is incorrect; 9.3.4.7 [dcl.fct.default] paragraph 4 permits parameter packs to follow parameters with default arguments.

History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6472
2019-09-24 00:00:00admincreate