diff options
author | Jason Merrill <jason@redhat.com> | 2020-12-02 17:11:48 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-12-02 22:15:54 -0500 |
commit | c03a78d8f8cac3019e7bc67b6ae39f4edc61cf2c (patch) | |
tree | a91b22d64976926d88b622aa66919ff41cff528e /gcc/print-rtl-function.c | |
parent | 54f97a226a0d8b315aa1a0129df957a8bb3fdf65 (diff) | |
download | gcc-c03a78d8f8cac3019e7bc67b6ae39f4edc61cf2c.zip gcc-c03a78d8f8cac3019e7bc67b6ae39f4edc61cf2c.tar.gz gcc-c03a78d8f8cac3019e7bc67b6ae39f4edc61cf2c.tar.bz2 |
c++: Push parms when late parsing default args
In this testcase we weren't catching the error in A::f because the parameter
'I' wasn't in scope, so the default argument for 'b' found the global
typedef I. Fixed by pushing the parms before parsing. This is a bit
complicated because pushdecl clears DECL_CHAIN; do_push_parm_decls deals
with this by nreversing first, but that doesn't work here because we only
want to push them one at a time; if we pushed all of them before parsing,
we'd wrongly reject A::g.
gcc/cp/ChangeLog:
* parser.c (cp_parser_primary_expression): Distinguish
parms from vars in error.
(cp_parser_late_parsing_default_args): Pushdecl parms
as we go.
gcc/testsuite/ChangeLog:
* g++.dg/parse/defarg17.C: New test.
Diffstat (limited to 'gcc/print-rtl-function.c')
0 files changed, 0 insertions, 0 deletions