Title
Ambiguous use of "declaration" in disambiguation section
Status
nad
Section
9.3.3 [dcl.ambig.res]
Submitter
Michiel Salters

Created on 2002-01-14.00:00:00 last changed 266 months ago

Messages

Date: 2002-04-15.00:00:00

Notes from the 4/02 meeting:

This is not a defect. Section 9.3.3 [dcl.ambig.res] reads:

The ambiguity arising from the similarity between a function-style cast and a declaration mentioned in 8.9 [stmt.ambig] can also occur in the context of a declaration. In that context, the choice is between a function declaration with a redundant set of parentheses around a parameter name and an object declaration with a function-style cast as the initializer. Just as for the ambiguities mentioned in 8.9 [stmt.ambig], the resolution is to consider any construct that could possibly be a declaration a declaration.

The wording "any construct" in the last sentence is not limited to top-level constructs. In particular, the function declaration encloses a parameter declaration, whereas the object declaration encloses an expression. Therefore, in case of ambiguity between these two cases, the declaration is parsed as a function declaration.

Date: 2002-01-14.00:00:00

In deciding whether a construct is an object declaration or a function declaration, 9.3.3 [dcl.ambig.res] contains the following gem: "In that context, the choice is between a function declaration [...] and an object declaration [...] Just as for the ambiguities mentioned in 8.9 [stmt.ambig], the resolution is to consider any construct that could possibly be a declaration a declaration."

To what declaration do the last two "declarations" refer? Object, function, or (following from the syntax) possibly parameter declarations?

History
Date User Action Args
2002-05-10 00:00:00adminsetmessages: + msg701
2002-05-10 00:00:00adminsetstatus: open -> nad
2002-01-14 00:00:00admincreate