]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: concept in default argument [PR109859]
authorMarek Polacek <polacek@redhat.com>
Wed, 18 Sep 2024 19:44:31 +0000 (15:44 -0400)
committerMarek Polacek <polacek@redhat.com>
Mon, 30 Sep 2024 19:20:31 +0000 (15:20 -0400)
commit4bcfaaed25b1b8ecc81f6a28d9ca76f00870dedf
treebab5c07fc8397dd14661f2e4ac5c72b6ab7b8997
parent65073a5b90c00a1c47efae8a67b9c754e2287ee0
c++: concept in default argument [PR109859]

1) We're hitting the assert in cp_parser_placeholder_type_specifier.
It says that if it turns out to be false, we should do error() instead.
Do so, then.

2) lambda-targ8.C should compile fine, though.  The problem was that
local_variables_forbidden_p wasn't cleared when we're about to parse
the optional template-parameter-list for a lambda in a default argument.

PR c++/109859

gcc/cp/ChangeLog:

* parser.cc (cp_parser_lambda_declarator_opt): Temporarily clear
local_variables_forbidden_p.
(cp_parser_placeholder_type_specifier): Turn an assert into an
error.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-defarg3.C: New test.
* g++.dg/cpp2a/lambda-targ8.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/parser.cc
gcc/testsuite/g++.dg/cpp2a/concepts-defarg3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/lambda-targ8.C [new file with mode: 0644]