[Bug c++/94306] Improve diagnostic when "requires" used instead of "requires requires" and add fix-it

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Mar 28 12:59:20 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94306

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:7981c06ae92548bd66f07121db1802eb6aec73ed

commit r10-7442-g7981c06ae92548bd66f07121db1802eb6aec73ed
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Mar 28 08:57:11 2020 -0400

    c++: Diagnose when "requires" is used instead of "requires requires"
[PR94306]

    This adds support to detect and recover from the case where an opening
brace
    immediately follows the start of a requires-clause.  So rather than
emitting the
    error

      error: expected primary-expression before '{' token

    followed by a slew of irrevelant errors, we now assume the user had
intended to
    write "requires requires {" and diagnose and recover accordingly.

    gcc/cp/ChangeLog:

            PR c++/94306
            * parser.c (cp_parser_requires_clause_opt): Diagnose and recover
from
            "requires {" when "requires requires {" was probably intended.

    gcc/testsuite/ChangeLog:

            PR c++/94306
            * g++.dg/concepts/diagnostic8.C: New test.


More information about the Gcc-bugs mailing list