What is the relevance of this statement in 7.1.6.1/1 in the C ++ standard?

7.1.6.1/1 contains the following instruction (highlighted by me):

There are two cv qualifiers, const and volatile. If the cv qualifier appears in the qualifier-seq, the declaration should not be empty in the init-declarator-list .

What is the relevance of the expression in bold above? In other words, is it possible to create an example of type cv-unqualified in the definition-specifier-seq in which the declaration-declaration-declaration is empty?

+7
c ++ language-lawyer volatile c ++ 11 const
source share
1 answer

Of course, most class and enum definitions use it:

struct A { }; // valid const struct B { }; // invalid, const would have no meaning const struct C { } c { }; // valid 

There is nothing else. The init-declarator list is used only in a simple declaration, and for this, the standard (C ++ 11) states:

7 Ads [dcl.dcl]

3 In a simple declaration, the optional init-declarator list can only be omitted when declaring a class (section 9) or listing (7.2), that is, when spec-specifier-seq contains either a qualifier class, a specified qualifier type with a class key (9.1) or an enumerator specifier.

+11
source share

All Articles