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

            Bug ID: 105787
           Summary: internal compiler error: tree check: expected
                    enumeral_type, have record_type in tsubst_copy
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tamas+...@hudson-trading.com
  Target Milestone: ---

The following code causes ICE (at least) on gcc 11.2, 11.3, 12.0 and 13.0.0
20220529 (experimental) when compiling with -std=c++20:

template <typename> class a;
class b;
template <> class a<b> {
public:
  enum class c { d };
  using enum c;
};
class b : public a<b> {};
template <int> class e { char g = (char)b::d; };
e<0> f;

Full error from "13.0.0 20220529":

<source>: In instantiation of 'constexpr e<0>::e()':
<source>:10:6:   required from here
<source>:9:44: internal compiler error: tree check: expected enumeral_type,
have record_type in tsubst_copy, at cp/pt.cc:16944
    9 | template <int> class e { char g = (char)b::d; };
      |                                         ~~~^
0x2200a89 internal_error(char const*, ...)
        ???:0
0x6fa097 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0x9c2aea tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x89984c get_nsdmi(tree_node*, bool, int)
        ???:0
0x8cd522 get_defaulted_eh_spec(tree_node*, int)
        ???:0
0x9c2108 maybe_instantiate_noexcept(tree_node*, int)
        ???:0
0x9c2093 maybe_instantiate_noexcept(tree_node*, int)
        ???:0
0x867369 mark_used(tree_node*, int)
        ???:0
0x776f5f build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ???:0
0x778c48 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        ???:0
0x8947ad build_aggr_init(tree_node*, tree_node*, int, int)
        ???:0
0x850c86 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ???:0
0x98cded c_parse_file()
        ???:0
0xb22051 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.

Godbolt link: https://godbolt.org/z/xcTTs3s3e

Reply via email to