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

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

Messages

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
2015-06-19 00:00:00admincreate