Created on 2024-03-22.00:00:00 last changed 4 days ago
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.
[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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-12-17 09:54:02 | admin | set | status: accepted -> wp |
2024-07-20 13:52:34 | admin | set | status: ready -> accepted |
2024-06-25 12:54:46 | admin | set | status: tentatively ready -> ready |
2024-05-17 22:24:28 | admin | set | status: open -> tentatively ready |
2024-04-07 11:43:58 | admin | set | messages: + msg7660 |
2024-03-22 00:00:00 | admin | create |