https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70627
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> --- The variant is created by: #0 copy_node_stat (node=0x7ffff6b7ab28) at ../../gcc/tree.c:1148 #1 0x0000000001364e93 in build_distinct_type_copy (type=0x7ffff6b7ab28) at ../../gcc/tree.c:6701 #2 0x000000000136506f in build_variant_type_copy (type=0x7ffff6b7ab28) at ../../gcc/tree.c:6741 #3 0x0000000001364b1a in build_qualified_type (type=0x7ffff6b7ab28, type_quals=1) at ../../gcc/tree.c:6637 #4 0x0000000000973077 in cp_build_qualified_type_real (type=0x7ffff6b7ab28, type_quals=1, complain=3) at ../../gcc/cp/tree.c:1151 #5 0x00000000008f208d in build_class_member_access_expr (object=..., member=0x7ffff6b63da8, access_path=0x0, preserve_reference=false, complain=3) at ../../gcc/cp/typeck.c:2448 #6 0x0000000000949f92 in finish_non_static_data_member (decl=0x7ffff6b63da8, object=0x7ffff6b76cc0, qualifying_scope=0x0) at ../../gcc/cp/semantics.c:1821 #7 0x0000000000950f6c in finish_id_expression (id_expression=0x7ffff6b78000, decl=0x7ffff6b63da8, scope=0x0, idk=0x7fffffffce9c, integral_constant_expression_p=false, allow_non_integral_constant_expression_p=false, non_integral_constant_expression_p=0x7ffff7ff5add, template_p=false, done=true, address_p=false, template_arg_p=false, error_msg=0x7fffffffcc18, location=304544) at ../../gcc/cp/semantics.c:3717 #8 0x000000000088cdb8 in cp_parser_primary_expression (parser=0x7ffff7ff5ab0, address_p=false, cast_p=false, template_arg_p=false, decltype_p=false, idk=0x7fffffffce9c) at ../../gcc/cp/parser.c:5285 #9 0x0000000000890370 in cp_parser_postfix_expression (parser=0x7ffff7ff5ab0, address_p=false, cast_p=false, member_access_only_p=false, decltype_p=false, pidk_return=0x0) at ../../gcc/cp/parser.c:6690 #10 0x00000000008936ae in cp_parser_unary_expression (parser=0x7ffff7ff5ab0, pidk=0x0, address_p=false, cast_p=false, decltype_p=false) at ../../gcc/cp/parser.c:7988 #11 0x000000000089448f in cp_parser_cast_expression (parser=0x7ffff7ff5ab0, address_p=false, cast_p=false, decltype_p=false, pidk=0x0) at ../../gcc/cp/parser.c:8665 #12 0x000000000089457d in cp_parser_binary_expression (parser=0x7ffff7ff5ab0, cast_p=false, no_toplevel_fold_p=false, decltype_p=false, prec=PREC_NOT_OPERATOR, pidk=0x0) at ../../gcc/cp/parser.c:8767 #13 0x0000000000895287 in cp_parser_assignment_expression (parser=0x7ffff7ff5ab0, pidk=0x0, cast_p=false, decltype_p=false) at ../../gcc/cp/parser.c:9055 #14 0x000000000089245d in cp_parser_parenthesized_expression_list (parser=0x7ffff7ff5ab0, is_attribute_list=0, cast_p=false, allow_expansion_p=true, non_constant_p=0x0, close_paren_loc=0x7fffffffd8dc) at ../../gcc/cp/parser.c:7459 and later we change TREE_TYPE of the main variant in: 0x000000000078a3ce in start_enum (name=0x7ffff6b77f20, enumtype=0x7ffff6b7ab28, underlying_type=0x7ffff6b7a930, attributes=0x0, scoped_enum_p=true, is_new=0x7fffffffe637) at ../../gcc/cp/decl.c:13231 13231 ENUM_UNDERLYING_TYPE (enumtype) = underlying_type; (gdb) bt #0 0x000000000078a3ce in start_enum (name=0x7ffff6b77f20, enumtype=0x7ffff6b7ab28, underlying_type=0x7ffff6b7a930, attributes=0x0, scoped_enum_p=true, is_new=0x7fffffffe637) at ../../gcc/cp/decl.c:13231 #1 0x00000000008a36d4 in cp_parser_enum_specifier (parser=0x7ffff7ff5ab0) at ../../gcc/cp/parser.c:17183 #2 0x00000000008a1266 in cp_parser_type_specifier (parser=0x7ffff7ff5ab0, flags=1, decl_specs=0x7fffffffe7f0, is_declaration=true, declares_class_or_enum=0x7fffffffe784, is_cv_qualifier=0x7fffffffe783) at ../../gcc/cp/parser.c:15806 #3 0x000000000089c342 in cp_parser_decl_specifier_seq (parser=0x7ffff7ff5ab0, flags=1, decl_specs=0x7fffffffe7f0, declares_class_or_enum=0x7fffffffe894) at ../../gcc/cp/parser.c:12758 #4 0x000000000089b90d in cp_parser_simple_declaration (parser=0x7ffff7ff5ab0, function_definition_allowed_p=true, maybe_range_for_decl=0x0) at ../../gcc/cp/parser.c:12301 #5 0x000000000089b899 in cp_parser_block_declaration (parser=0x7ffff7ff5ab0, statement_p=false) at ../../gcc/cp/parser.c:12248 #6 0x000000000089b61c in cp_parser_declaration (parser=0x7ffff7ff5ab0) at ../../gcc/cp/parser.c:12145 #7 0x000000000089b16e in cp_parser_declaration_seq_opt (parser=0x7ffff7ff5ab0) at ../../gcc/cp/parser.c:12024 #8 0x000000000088b25e in cp_parser_translation_unit (parser=0x7ffff7ff5ab0) at ../../gcc/cp/parser.c:4323 Jason, perhaps start_enum wants to walk variants and update them after finalizing underlying type? I am also fine with disabling the check and deferring for next stage1.