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

Created on 2015-06-19.00:00:00 last changed 2 weeks 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: 2015-06-19.00:00:00

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-05-31 21:07:31adminsetstatus: drafting -> tentatively ready
2024-05-24 15:00:24adminsetmessages: + msg7707
2015-06-19 00:00:00admincreate