[Bug c++/106052] New: ICE with -Wmismatched-tags with partially specialized friend struct of self type

beardsley.matt.j at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 22 04:03:12 GMT 2022


            Bug ID: 106052
           Summary: ICE with -Wmismatched-tags with partially specialized
                    friend struct of self type
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: beardsley.matt.j at gmail dot com
  Target Milestone: ---

The following uses gcc built from a fresh repo that I just cloned earlier today
(default build settings)

    template <typename T1, typename T2>
    struct S {
        template <typename, typename>
        struct S2;

        template <typename Type>
        struct S2<Type, bool> {};

        friend struct S2<S<T1, T2>, bool>;

No ICE with warning off:
$ g++ -c tmp.cpp -o /dev/null -Wno-mismatched-tags
(no output)

ICE with warning on:
$ g++ -c tmp.cpp -o /dev/null -Wmismatched-tags
tmp.cpp: In substitution of ‘template<class Type> struct S<T1, T2>::S2<Type,
bool> [with Type = S<T1, T2>]’:
tmp.cpp:10:2:   required from here
tmp.cpp:10:2: internal compiler error: tree check: accessed elt 2 of ‘tree_vec’
with 1 elts in tsubst, at cp/pt.cc:15831
   10 | };
      |  ^
0x8ae378 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
0x9d5d11 tree_vec_elt_check(tree_node*, int, char const*, int, char const*)
0xb71967 tsubst(tree_node*, tree_node*, int, tree_node*)
0xb7ff0e tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
0xb80132 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
0xb6eca7 get_partial_spec_bindings
0xb6f15b most_specialized_partial_spec(tree_node*, int)
0xaf2970 specialization_of
0xaf2970 class_decl_loc_t::diag_mismatched_tags(tree_node*)
0xaf8db8 class_decl_loc_t::diag_mismatched_tags()
0xb3c292 c_parse_file()
0xc721d1 c_common_parse_file()
Please submit a full bug report, with preprocessed source (by using
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

More information about the Gcc-bugs mailing list