PR c++/39751: ICE-on-invalid parsing regression.
authorRoger Sayle <roger@nextmovesoftware.com>
Thu, 10 Mar 2022 07:32:06 +0000 (07:32 +0000)
committerRoger Sayle <roger@nextmovesoftware.com>
Thu, 10 Mar 2022 07:32:06 +0000 (07:32 +0000)
commit2185c9734ad977b88c519a4579187a91b3f71edd
treebf785bb78f3b940d20847443d4a315c136da05f8
parent8cc4f9cd824d195178632569c749f96b306475f9
PR c++/39751: ICE-on-invalid parsing regression.

This is a fix for PR c++/39751 which is an ICE-on-invalid regression in
the C++ parser after encountering the end of file.  The one line change
is to check that the tokens cached in DECL_PENDING_INLINE_INFO haven't
been purged before processing them in cp_parser_late_parsing_for_member.

2022-03-10  Roger Sayle  <roger@nextmovesoftware.com>

gcc/cp/ChangeLog
PR c++/39751
* parser.cc (cp_parser_late_parsing_for_member): Confirm the token
stream hasn't been purged before processing DECL_PENDING_INLINE.

gcc/testsuite/ChangeLog
PR c++/39751
* g++.dg/parse/pr39751.C: New test case.
gcc/cp/parser.cc
gcc/testsuite/g++.dg/parse/pr39751.C [new file with mode: 0644]