c++: Fix late-parsed default arg context
authorJason Merrill <jason@redhat.com>
Wed, 2 Dec 2020 19:35:50 +0000 (14:35 -0500)
committerJason Merrill <jason@redhat.com>
Thu, 3 Dec 2020 03:15:48 +0000 (22:15 -0500)
commit54f97a226a0d8b315aa1a0129df957a8bb3fdf65
tree163143bb5ecf427bad44c123cb2f3b906b6ccbab
parent81d590760c31e11e3a09135f4e182aea232035f2
c++: Fix late-parsed default arg context

Jakub noticed that we weren't recognizing a default argument for a consteval
member function as being in immediate function context because there was no
function parameter scope to look at.

Note that this patch doesn't actually push the parameters into the scope,
that happens in a separate commit.

gcc/cp/ChangeLog:

* name-lookup.c (begin_scope): Set immediate_fn_ctx_p.
* parser.c (cp_parser_late_parsing_default_args): Push
sk_function_parms scope.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/consteval-defarg1.C: New test.
gcc/cp/name-lookup.c
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp2a/consteval-defarg1.C [new file with mode: 0644]