c++: Fix scan forward over pragma [PR96257]
authorNathan Sidwell <nathan@acm.org>
Tue, 21 Jul 2020 19:37:58 +0000 (12:37 -0700)
committerNathan Sidwell <nathan@acm.org>
Tue, 21 Jul 2020 19:42:09 +0000 (12:42 -0700)
commit4d6e94960aa199b2fe7bf5a66f98bd7691884c1d
treea9e4bce1eb8d4b9514d0baa8322d95d61fb1e0fa
parent28f2a080cc27531a8c78aec9f44aeff4961c2a4c
c++: Fix scan forward over pragma [PR96257]

It turns out that the paren scanning code is used for speculatively searching
to see if we're looking at a compound_literal.  So we shouldn't always purge
pragma tokens.

gcc/cp/
* parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
(cp_parser_skip_to_closing_parenthesis_1): Only pass start token
to pragma skipper if recovering.
(cp_parser_skip_to_pragma_eol): Only purge and change pragma
state when recovering.
gcc/testsuite/
* g++.dg/parse/pr96257.C: New.
gcc/cp/parser.c
gcc/testsuite/g++.dg/parse/pr96257.C [new file with mode: 0644]