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

            Bug ID: 117102
           Summary: internal compiler error: tree check: accessed elt 2 of
                    'tree_vec' with 1 elts in unify, at cp/pt.cc:24866
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yihan4845 at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/qx5TTdE3d

The following program:
```cpp
template<int a, auto F2> struct S;
template<int a, class C2, auto C2::* F2> struct S<a, F2> {};

class Bar {
    void f(){}
    S<0, &Bar::f> c;
};
```

will trigger segmentation fault for gcc trunk.

Stack dump:
```
0x2854355 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2868135 internal_error(char const*, ...)
        ???:0
0x99bfd7 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
        ???:0
0xb05396 tree_vec_elt_check(tree_node*, int, char const*, int, char const*)
        ???:0
0xcb7d71 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int, tree_node*)
        ???:0
0xcbf5c5 most_specialized_partial_spec(tree_node*, int, bool)
        ???:0
0xcf8e35 instantiate_class_template(tree_node*)
        ???:0
0xb6e767 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ???:0
0xb8e3c0 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ???:0
0xc98d9a c_parse_file()
        ???:0
0xdf0959 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

Reply via email to