Title
Function/variable declaration ambiguity
Status
dr
Section
9.5.1 [dcl.fct.def.general]
Submitter
Richard Smith

Created on 2015-06-19.00:00:00 last changed 4 months ago

Messages

Date: 2024-05-15.00:00:00

Additional notes (May, 2024)

Issue 2876 introduced a framework to distinguish the parsing. Its resolution was extended to also resolve this issue.

Date: 2024-06-15.00:00:00

[Accepted as a DR at the June, 2024 meeting.]

The following fragment,

  int f() {};

is syntactically ambiguous. It could be either a function-definition followed by an empty-declaration, or it could be a simple-declaration whose init-declarator has the brace-or-equal-initializer {}. The same is true of a variable declaration

  int a {};

since function-definition simply uses the term declarator in its production.

History
Date User Action Args
2024-07-20 13:52:34adminsetstatus: ready -> dr
2024-06-25 12:54:46adminsetstatus: tentatively ready -> ready
2024-05-31 21:07:31adminsetstatus: drafting -> tentatively ready
2024-05-24 15:00:24adminsetmessages: + msg7707
2015-06-19 00:00:00admincreate