aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-07-09 20:44:05 -0400
committerMarek Polacek <polacek@redhat.com>2020-07-13 11:16:26 -0400
commit4fd124a23664c712f1bb1a7e91fa23fe83d72c0b (patch)
treebf531bd00cb45a068315df2381a431e891c5eff5 /gcc/fortran/resolve.c
parenta43125192237ce7f3aac7406fd425f9aaad7d9bf (diff)
downloadgcc-4fd124a23664c712f1bb1a7e91fa23fe83d72c0b.zip
gcc-4fd124a23664c712f1bb1a7e91fa23fe83d72c0b.tar.gz
gcc-4fd124a23664c712f1bb1a7e91fa23fe83d72c0b.tar.bz2
c++: Fix tentative parsing of enum-specifier [PR96077]
Here's an interesting issue: in this code a ) is missing: enum { E = (2 } e; but we compile the code anyway, and E is set to 0 in build_enumerator, which is sneaky. The problem is that cp_parser_enum_specifier parses tentatively, because when we see the enum keyword, we don't know yet if we'll find an enum-specifier, opaque-enum-declaration, or elaborated-enum-specifier. In this test when we call cp_parser_enumerator_list we're still parsing tentatively, and as a consequence, parens.require_close (parser) in cp_parser_primary_expression doesn't report any errors. But we only go on to parse the enumerator-list after we've seen a {, at which point we might as well commit -- we know we're dealing with an enum-specifier. gcc/cp/ChangeLog: PR c++/96077 * parser.c (cp_parser_enum_specifier): Commit to tentative parse after we've seen an opening brace. gcc/testsuite/ChangeLog: PR c++/96077 * g++.dg/parse/enum14.C: New test.
Diffstat (limited to 'gcc/fortran/resolve.c')
0 files changed, 0 insertions, 0 deletions