Boost Users :
From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2005-07-01 10:12:48
Brian Allison wrote:
> The next production rule is:
> decl-specifier-seqopt init-declarator-listopt ;/
> Note that the only thing that isn't /optional/ is the semicolon.
> Presuming the book has no typos, presuming the grammar is a valid
> representation of the C++ specification,
This grammar matches that given in the standard, but that is
informative, not normative. It is not allowable for both the "optional"
parts to be missing. 7/3 says that "...the optional
/init-declarator-list /can be omitted only when declaring a class...or
enumeration..." and 7/7 says that "[o]nly in function declarations for
constructors, destructors, and type conversions can the
/decl-specifier-seq /be omitted."
> then it would seem that a spurious semicolon at the end of any global
> declaration is itself a global declaration and is not an error.
It is an error. A redundant semi-colon is only allowed as a degenerate
case of an expression statement, where such statements are allowed, or
immediately after a member function definition within a class definition.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net