C++: Fix handling of && after a class definition.
The compiler now correctly parses rvalue references (&&) immediately following a class definition, fixing a regression.
A recent change caused the compiler to incorrectly reject rvalue references (&&) immediately after a class definition (e.g., struct {} && m = {};). This commit corrects the parser to allow && in this context, similar to how :: is handled. This fixes a regression introduced by an earlier change and restores correct parsing of C++ code.
In Details
The issue stems from the parser's handling of class specifiers in cp_parser_class_specifier within parser.cc. The code was incorrectly diagnosing a missing semicolon after a class definition when an rvalue reference (&&) followed the definition. This commit modifies cp_parser_class_specifier to correctly accept && after a class definition, resolving the parsing error. This is analogous to the fix for :: in revision r12-8304-g851031b2fcd5210b9676.
For Context
Compilers parse source code to understand its structure and meaning. The C++ parser needs to correctly interpret the language's syntax rules, including how different elements can follow a class definition. This commit addresses a bug where the compiler was incorrectly flagging rvalue references (denoted by &&) immediately following a class definition as a syntax error. The fix ensures that the compiler correctly understands and processes this specific C++ syntax.