C++11 standard ref for allowed type definitions in type specifier uses?
c++, c++11, language-lawyer, specifier, type-declaration
Solution
The reason it can't be found in the C++ standard is because it's actually prohibited in a delta from the C standard.
In C.1.4 we have the following: `Change: Types must be declared in declarations, not in expressions In C, a sizeof expression or cast expression may create a new type.` which shows the prohibition in question.
This is explicitly called out in 7.1.6/3:
At least one type-specifier that is not a cv-qualifier is required in a declaration unless it declares a constructor, destructor or conversion function.92 A type-specifier-seq shall not define a class or enumeration unless it appears in the type-id of an alias-declaration (7.1.3) that is not the declaration of a template-declaration.
where the part of particular interest is that `A type-specifier-seq shall not define a class or enumeration unless...`
Problem
In C++11 a type specifier includes class specifiers and enum specifiers. (aka class definitions and enumeration definitions) According to the grammar/syntax - type specifiers can appear in several places in the language, but not in all those places are class specifiers and enum specifiers allowed. For example: ``` struct C{} c; // ok: types may be defined in the specifiers of a simple declaration void f(struct S{}); // error: types may not be defined in parameter types constexpr auto i = sizeof(enum E{}); // error: types may not be defined in ‘sizeof’ expressions ``` Where in the standard does it partition these uses of type specifiers into those where types may and may not be defined? For example, where is the rule that says types may not be defined in a sizeof expression?