[Bug c++/102161] New: Compiler crashes when taking the address of an enum

meinaccountnr2 at web dot de gcc-bugzilla@gcc.gnu.org
Wed Sep 1 16:07:15 GMT 2021


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

            Bug ID: 102161
           Summary: Compiler crashes when taking the address of an enum
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: meinaccountnr2 at web dot de
  Target Milestone: ---

The compiler crashes on this code:

template<class> struct a {};
template<a entr> struct b {};
struct s{ enum enu {a}; };
using T = b<{&s::enu}>;

gcc 10.1  https://godbolt.org/z/r64EhbaGr
gcc 10.2  https://godbolt.org/z/cT9PE9h4o
gcc 10.3  https://godbolt.org/z/Y88jaEMrd
gcc 11.1  https://godbolt.org/z/KfsEhqaM5
gcc 11.2  https://godbolt.org/z/T797EWoE5
gcc trunk https://godbolt.org/z/3Mdo67M64

gcc commit 2cc65fcbd470de8240f64317629a60fab879dfc5 stacktrace:

/home/raphael/repos/cpp/source/gcc_kill_value_param_1.cpp:4:22: internal
compiler error: in coerce_template_parms, at cp/pt.c:9060
    4 | using T = b<{&s::enu}>;
      |                      ^
0x68201a coerce_template_parms
        /home/raphael/repos/build-gcc/gcc/gcc/cp/pt.c:9060
0x831817 lookup_template_class_1
        /home/raphael/repos/build-gcc/gcc/gcc/cp/pt.c:9843
0x832a6c lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        /home/raphael/repos/build-gcc/gcc/gcc/cp/pt.c:10230
0x8579cd finish_template_type(tree_node*, tree_node*, int)
        /home/raphael/repos/build-gcc/gcc/gcc/cp/semantics.c:3639
0x7f2f9f cp_parser_template_id
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:18151
0x7f31eb cp_parser_class_name
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:25463
0x7eb44a cp_parser_qualifying_entity
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:7046
0x7eb44a cp_parser_nested_name_specifier_opt
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:6728
0x8011c5 cp_parser_simple_type_specifier
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:19561
0x7e028d cp_parser_type_specifier
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:19220
0x7f0763 cp_parser_type_specifier_seq
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:24125
0x7eeb34 cp_parser_type_id_1
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:23925
0x7f14b8 cp_parser_type_id
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:24021
0x7f14b8 cp_parser_alias_declaration
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:21551
0x80ec85 cp_parser_declaration
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:14795
0x80f5dc cp_parser_toplevel_declaration
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:14816
0x80f5dc cp_parser_translation_unit
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:4978
0x80f5dc c_parse_file()
        /home/raphael/repos/build-gcc/gcc/gcc/cp/parser.c:46789
0x8e52fd c_common_parse_file()
        /home/raphael/repos/build-gcc/gcc/gcc/c-family/c-opts.c:1223


More information about the Gcc-bugs mailing list