]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix endless errors on invalid requirement seq [PR97742]
authorJakub Jelinek <jakub@redhat.com>
Fri, 12 Feb 2021 08:55:46 +0000 (09:55 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 19 Mar 2021 23:27:48 +0000 (00:27 +0100)
commita7237df0aa26f74cc52103f5c8dba5f0efbb198f
treed74c8f51a47b9086a832efa11538ab8e2d6a0bf9
parentea535f59b19f65e5b313c990ee6c194a7b055bd7
c++: Fix endless errors on invalid requirement seq [PR97742]

As the testcase shows, if we reach CPP_EOF during parsing of requirement
sequence, we end up with endless loop where we always report invalid
requirement expression, don't consume any token (as we are at eof) and
repeat.

This patch stops the loop when we reach CPP_EOF.

2021-02-12  Jakub Jelinek  <jakub@redhat.com>

PR c++/97742
* parser.c (cp_parser_requirement_seq): Stop iterating after reaching
CPP_EOF.

* g++.dg/cpp2a/concepts-requires24.C: New test.

(cherry picked from commit cf059e1c099ed45c97f740c030dcb8e146ac7d4a)
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp2a/concepts-requires24.C [new file with mode: 0644]