[Bug c++/65271] [13/14 Regression] Declarator after class-specifier cannot declare rvalue reference
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 17 13:41:47 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65271
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Andrew Pinski
<pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:048389459627b8d65506b9d1495c3d9562e6e6b3
commit r14-12679-g048389459627b8d65506b9d1495c3d9562e6e6b3
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date: Sun Apr 19 22:05:10 2026 -0700
c++: Fix handling of && after a class definition [PR65271]
After r166977, we are wrongly rejecting:
struct {} && m = {};
because our code to diagnose a missing ; after a class definition doesn't
realize that && can follow a class definition.
This is simlar in nature to what was done for `::` in
r12-8304-g851031b2fcd5210b9676.
Bootstrapped and tested on x86_64-linux-gnu.
Changes since v1:
* v2: Remove the check on c++11 and add a few more testcases.
* v3: Move CPP_AND_AND right below CPP_AND_AND and add enum case to the
testcase.
PR c++/65271
gcc/cp/ChangeLog:
* parser.cc (cp_parser_class_specifier): Accept &&.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/rv-decl1.C: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
(cherry picked from commit 44c5485dac70d7f0d62e880b1162d49805404ed8)
More information about the Gcc-bugs
mailing list