https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99678
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:20cda2e85c307096a3856f7f27215b8a28982fb6 commit r14-10320-g20cda2e85c307096a3856f7f27215b8a28982fb6 Author: Patrick Palka <ppa...@redhat.com> Date: Thu Jun 13 10:16:10 2024 -0400 c++: undeclared identifier in requires-clause [PR99678] Since the terms of a requires-clause are grammatically primary-expressions and not e.g. postfix-expressions, it seems we need to explicitly handle and diagnose the case where a term parses to a bare unresolved identifier, like cp_parser_postfix_expression does, since cp_parser_primary_expression leaves that up to its callers. Otherwise we incorrectly accept the first three requires-clauses below. Note that the only occurrences of primary-expression in the grammar are postfix-expression and constraint-logical-and-expression, so it's not too surprising that we need this special handling here. PR c++/99678 gcc/cp/ChangeLog: * parser.cc (cp_parser_constraint_primary_expression): Diagnose a bare unresolved unqualified-id. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-requires38.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com> (cherry picked from commit d387ecb2b2f44f33fd6a7c5ec7eadaf6dd70efc9)