This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Accepted at the June, 2024 meeting.]
P2573R2 (= delete("should have a reason");), adopted in Tokyo, does not disambiguate the following syntax:
using T = void (); using U = int; T a = delete ("hello"); U b = delete ("hello");
Either may be parsed as a (semantically ill-formed) simple-declaration whose initializer is a delete-expression or as a function-definition.
Proposed resolution (approved by CWG 2024-05-31):
Change and split 9.1 [dcl.pre] paragraph 9 as follows:
An object definition causes storage of appropriate size and alignment to be reserved and any appropriate initialization (9.4 [dcl.init]) to be done.
Syntactic components beyond those found in the general form of simple-declaration are added to a function declaration to make a function-definition. A token sequence starting with { or = is treated as a function-body (9.5.1 [dcl.fct.def.general]) if the type of the declarator-id (9.3.4.1 [dcl.meaning.general]) is a function type, and is otherwise treated as a brace-or-equal-initializer (9.4.1 [dcl.init.general]). [ Note: If the declaration acquires a function type through template instantiation, the program is ill-formed; see 13.9.1 [temp.spec.general]. The function type of a function definition cannot be specified with a typedef-name (9.3.4.6 [dcl.fct]). --end note ]
An object declaration, however, is also a definition unless it contains the extern specifier and has no initializer (6.2 [basic.def]). An object definition causes storage of appropriate size and alignment to be reserved and any appropriate initialization (9.4 [dcl.init]) to be done.
This drafting also resolves issue 2144.