https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85208

            Bug ID: 85208
           Summary: ICE with #pragma weak and structured binding
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet (compiled with "-std=c++17") triggers
an ICE since GCC 7.1.0 (when structured bindings were introduced):

======================
#pragma weak foo

struct A { int i; };

auto [a] = A();
======================

bug.cc:5:6: internal compiler error: in write_unqualified_name, at
cp/mangle.c:1338
 auto [a] = A();
      ^~~
0x619dda write_unqualified_name
        ../../gcc/gcc/cp/mangle.c:1338
0x8e61a7 write_name
        ../../gcc/gcc/cp/mangle.c:937
0x8e5986 write_encoding
        ../../gcc/gcc/cp/mangle.c:825
0x8ea224 mangle_decl_string
        ../../gcc/gcc/cp/mangle.c:3792
0x8f0070 get_mangled_id
        ../../gcc/gcc/cp/mangle.c:3814
0x8f0070 mangle_decl(tree_node*)
        ../../gcc/gcc/cp/mangle.c:3852
0x1147c4d decl_assembler_name(tree_node*)
        ../../gcc/gcc/tree.c:687
0xa4cfdc maybe_apply_pragma_weak(tree_node*)
        ../../gcc/gcc/c-family/c-pragma.c:291
0x8abea4 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:5094
0x94466d cp_parser_decomposition_declaration
        ../../gcc/gcc/cp/parser.c:13262
0x94466d cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:12979
0x945218 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:12874
0x9491a2 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12772
0x9495b1 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12648
0x9498a4 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4563
0x9498a4 c_parse_file()
        ../../gcc/gcc/cp/parser.c:39016
0xa494d6 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

Reply via email to