OK, thanks I see. But, is this intent worded somewhere in the spec
aswell? As far as declarations that contain decl-specifier-seq are
concerned we have at 7p10 that says
"If the decl-specifier-seq contains no typedef specifier, the
declaration is called a function declaration if the type associated
with the name is a function type ([dcl.fct]) and an object declaration
otherwise.".
Am am not totally sure whether this only applies to
simple-declarations (because of the location of that paragraph), or
whether it applies to all declarations that contain
decl-specifier-seqs. Another thing is, because it indicate that an
"object declaration" is not quite the same as a "declaration of an
object", it becomes very involved. Are the following summaries correct
based on your answers and the spec?
struct A {
int &b; // Not the declaration of an object. But an object
declaration. And the declaration of a reference
int c; // Not the declaration of an object. But an object declaration
};
extern int &d; // Not the declaration of an object. But an object
declaration. And the declaration of a reference
int e; // The declaration of an object. And an object declaration.
But not the declaration of a reference
Are they correct concerning the intent? Would it not make sense to
distinguish between object declarations and reference declarations?
Other places in the spec seem to use "object declaration" as implying
that they declare objects, like 7.1.5p9:
"A constexpr specifier used in an object declaration declares the
object as const."
On the other hand, there's evidence that other places use "object
declaration" to mean "declaration that gives names an object or
reference type", such as 8.2p1:
"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."
This indicates that this term "object declaration" was not updated
properly when references were added to the language?
Thanks