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

            Bug ID: 93383
           Summary: ICE on accessing field of a structure which is
                    non-type template parameter, -std=c++2a
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nikita.provotorov.main at gmail dot com
  Target Milestone: ---

Snippet of code which causes GCC crash:

template <int N>
struct fixed_string {
    char content[N] = {};

    constexpr fixed_string(const char (&)[N]) noexcept {}
};

template <int N> fixed_string(const char (&)[N]) -> fixed_string<N>;


template<fixed_string Str>
struct bar
{};

template<fixed_string Str>
struct foo
{
    using type = bar<Str.content>;
};


Exact compiler version: 10.0.0 20200111
Used compiler flags: -Wall -Wextra -std=c++2a
Godbolt reference: https://godbolt.org/z/tAnFxP


Compiler output:

internal compiler error: Segmentation fault
   18 |     using type = bar<Str.content>;
      |                                 ^
0xc12a5f crash_signal
        ../../source/gcc/toplev.c:328
0x5fed33 resolve_args(vec<tree_node*, va_gc, vl_embed>*, int)
        ../../source/gcc/cp/call.c:4429
0x70e69f do_class_deduction
        ../../source/gcc/cp/pt.c:28566
0x70e69f do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ../../source/gcc/cp/pt.c:28699
0x70faf2 convert_template_argument
        ../../source/gcc/cp/pt.c:8325
0x72261f convert_template_argument
        ../../source/gcc/cp/pt.c:8098
0x72261f coerce_template_parms
        ../../source/gcc/cp/pt.c:8829
0x72640a lookup_template_class_1
        ../../source/gcc/cp/pt.c:9666
0x72768c lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../source/gcc/cp/pt.c:10038
0x74291d finish_template_type(tree_node*, tree_node*, int)
        ../../source/gcc/cp/semantics.c:3405
0x6eb83d cp_parser_template_id
        ../../source/gcc/cp/parser.c:16659
0x6ebaaa cp_parser_class_name
        ../../source/gcc/cp/parser.c:23564
0x6e89c1 cp_parser_qualifying_entity
        ../../source/gcc/cp/parser.c:6727
0x6e89c1 cp_parser_nested_name_specifier_opt
        ../../source/gcc/cp/parser.c:6410
0x6efc2f cp_parser_simple_type_specifier
        ../../source/gcc/cp/parser.c:18054
0x6d6bfd cp_parser_type_specifier
        ../../source/gcc/cp/parser.c:17712
0x6ea094 cp_parser_type_specifier_seq
        ../../source/gcc/cp/parser.c:22271
0x6e4444 cp_parser_type_id_1
        ../../source/gcc/cp/parser.c:22100
0x6e5608 cp_parser_type_id
        ../../source/gcc/cp/parser.c:22179
0x6e5608 cp_parser_alias_declaration
        ../../source/gcc/cp/parser.c:19927

Reply via email to