gnu/gcc/7d46e0676e2e6b106483887ce84b8cb3042d51ea c++: Fix lambda scope cleanup after class error [PR125343]
cp_parser_class_head opens a lambda mangling scope for a valid class
head. If begin_class_definition rejects that type, it replaces it with
error_mark_node. The old cleanup condition consequently leaves the
scope open, and lambda error recovery reaches
record_lambda_scope_sig_discriminator with the wrong active scope.
Remember whether the class head opened a lambda scope and use that
state for cleanup independently of whether the definition succeeds.
PR c++/125343
gcc/cp/ChangeLog:
* parser.cc (cp_parser_class_specifier): Preserve whether the
class head opened a lambda scope and use it for cleanup.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/pr125343.C: New test.
Signed-off-by: Odysseas Georgoudis <odygrd@hotmail.com>
2 files changed