Title
Can an explicit object parameter have a default argument?
Status
c++23
Section
9.3.4.6 [dcl.fct]
Submitter
GB

Created on 2022-11-03.00:00:00 last changed 16 months ago

Messages

Date: 2022-11-08.20:30:28

Proposed resolution (approved by CWG 2022-11-08):

Change in 9.3.4.6 [dcl.fct] paragraph 3 as follows:

parameter-declaration:
    attribute-specifier-seqopt thisopt decl-specifier-seq declarator
    attribute-specifier-seqopt thisopt decl-specifier-seq declarator = initializer-clause
    attribute-specifier-seqopt thisopt decl-specifier-seq abstract-declaratoropt
    attribute-specifier-seqopt thisopt decl-specifier-seq abstract-declaratoropt = initializer-clause
Date: 2022-11-27.21:00:25
P2720R0 comment GB 051

[Accepted at the November, 2022 meeting.]

The syntax and semantics appear to allow:

  struct S { void f(this const S& = S{}); };
This is probably no more than an oddity, but perhaps it should be prevented.

History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: wp -> open
2023-02-18 18:43:04adminsetstatus: accepted -> wp
2022-11-25 05:14:04adminsetstatus: nb -> accepted
2022-11-08 20:29:48adminsetstatus: open -> nb
2022-11-08 20:29:48adminsetstatus: open -> open
2022-11-08 20:29:48adminsetstatus: open -> open
2022-11-08 20:29:48adminsetstatus: open -> open
2022-11-08 14:15:22adminsetstatus: nb -> open
2022-11-08 14:15:22adminsetstatus: nb -> nb
2022-11-08 14:15:22adminsetstatus: nb -> nb
2022-11-08 14:15:22adminsetmessages: + msg6982
2022-11-03 00:00:00admincreate