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

            Bug ID: 106011
           Summary: [12 Regression] ICE: unexpected expression 'ElemSize'
                    of kind template_parm_index
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org
  Target Milestone: ---

seen with the gcc-12 branch 20220616, trying to build the 0ad package:

$ cat Unified_cpp_js_src4.ii
typedef unsigned size_t;
template <size_t ElemSize> decltype(0 % ElemSize == 0)

$ LANG=C g++ -c -O0 Unified_cpp_js_src4.ii
Unified_cpp_js_src4.ii:2:50: internal compiler error: unexpected expression
'ElemSize' of kind template_parm_index
    2 | template <size_t ElemSize> decltype(0 % ElemSize == 0)
      |                                     ~~~~~~~~~~~~~^~~~
0x6d9b71 cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.cc:7587
0x6d9ec0 cxx_eval_outermost_constant_expr
        ../../src/gcc/cp/constexpr.cc:7824
0x6dbdcc potential_constant_expression_1
        ../../src/gcc/cp/constexpr.cc:9274
0x6dc636 potential_constant_expression_1(tree_node*, bool, bool, bool, int)
        ../../src/gcc/cp/constexpr.cc:9550
0x6dc636 is_constant_expression(tree_node*)
        ../../src/gcc/cp/constexpr.cc:9607
0x6dc636 is_nondependent_constant_expression(tree_node*)
        ../../src/gcc/cp/constexpr.cc:9644
0x6dd0c0 maybe_constant_value(tree_node*, tree_node*, bool)
        ../../src/gcc/cp/constexpr.cc:8071
0x7435eb fold_for_warn(tree_node*)
        ../../src/gcc/cp/expr.cc:416
0x8ad582 shorten_compare(unsigned int, tree_node**, tree_node**, tree_node**,
tree_code*)
        ../../src/gcc/c-family/c-common.cc:3237
0x86fef7 cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
        ../../src/gcc/cp/typeck.cc:6158
0x6b97ac build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
        ../../src/gcc/cp/call.cc:6935
0x866dff build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
        ../../src/gcc/cp/typeck.cc:4563
0x80a7c7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.cc:20369
0x80e32a instantiate_non_dependent_expr_internal(tree_node*, int)
        ../../src/gcc/cp/pt.cc:6367
0x80e32a instantiate_non_dependent_expr_sfinae(tree_node*, int)
        ../../src/gcc/cp/pt.cc:6388
0x846e6f finish_decltype_type(tree_node*, bool, int)
        ../../src/gcc/cp/semantics.cc:11255
0x7cfb31 cp_parser_decltype
        ../../src/gcc/cp/parser.cc:16540
0x7e7447 cp_parser_simple_type_specifier
        ../../src/gcc/cp/parser.cc:19647
0x7c5435 cp_parser_type_specifier
        ../../src/gcc/cp/parser.cc:19424
0x7c6349 cp_parser_decl_specifier_seq
        ../../src/gcc/cp/parser.cc:15905
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.

Reply via email to