c++: Directly fixup deferred eh-specs
eh-specifiers in a class definition are complete-definition contexts,
and we sometimes need to deferr their parsing. We create a deferred
eh specifier, which can end up persisting in the type system due to
variants being created before the deferred parse. This causes
problems in modules handling.
This patch adds fixup_deferred_exception_variants, which directly
modifies the variants of such an eh spec once parsed. As commented,
the general case is quite hard, so it doesn't deal with everything.
But I do catch the cases I encountered (from the std library).
gcc/cp/
* cp-tree.h (fixup_deferred_exception_variants): Declare.
* parser.c (cp_parser_class_specifier_1): Call it when
completing deferred parses rather than creating a variant.
(cp_parser_member_declaration): Move comment from ...
(cp_parser_noexcept_specification_opt): ... here. Refactor the
deferred parse.
* tree.c (fixup_deferred_exception_variants): New.