https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127295
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <[email protected]>: https://gcc.gnu.org/g:3bd34f8936c7edb25d35bc2816a863ca902938bf commit r17-4498-g3bd34f8936c7edb25d35bc2816a863ca902938bf Author: Joshua Berne <[email protected]> Date: Mon Sep 21 00:09:58 2026 +0100 c++/contracts: fix handling of __contract_assert [PR127295] PR c++/127295 - [c++26][contracts] ICE in grok_contract on the __contract_assert extension spelling The gcc-specific spelling of contract_assert, __contract_assert, was untested and just didn't work. Changed uses of the raw string "contract_assert" to identify the token based on what was parsed (which identifies both contract_assert and __contract_assert as a reserved identifier with the code RID_CONTASSERT). Add one use of the alternate spelling in a test, as well as a test of the previously untested diagnostic that includes the keyword spelling in its output. PR c++/127295 gcc/cp/ChangeLog: * contracts.cc (grok_contract): Identify assertion statements by keyword and not string comparison. * parser.cc (cp_parser_contract_assert): Include keyword used on token in diagnostics. gcc/testsuite/ChangeLog: * g++.dg/contracts/cpp26/assertion-statement.C: Add use of __contract_assert. * g++.dg/contracts/cpp26/assertion-statement-errors.C: Test attribute warning with __contract_assert. * g++.dg/contracts/cpp26/no_contracts.C: Check keyword errors with -fno-contracts. Signed-off-by: Joshua Berne <[email protected]>
