Basically it implements the https://eel.is/c++draft/dcl.pre#5 rule.
The motivation is to eliminate a false parse (simple declaration) for the enum
declaration.
// A simple declaration without a declarator // or an opaque-enum-declaration enum a;
However, it has some negative effects on broken code (with the single-type
decl-specifier-seq guard):
- break the const int; case (which we used to parse as a declaration without declarator), now we fails to parse, because it is invalid code per the C++ spec.
- regress the const Foo; case, now we parse it as a declaration with a declarator named Foo and const as the decl-specifier-seq, vs we used to parsed as a declaration without declarator (which is better IMO);
Just post here to get thoughts about it:
My feeling is that this degrades the parser a lot for the little benefit we gain,
we probably don't move forward with this approach.