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

            Bug ID: 121151
           Summary: ICE: in break_out_target_exprs, at cp/tree.cc:3339
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: ice-checking, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rush102333 at gmail dot com
  Target Milestone: ---

The following code starts to trigger an ICE since gcc-12.3 with assertion
enabled:


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

template<typename ...T> void f(int x = 0, T ...); // #2
template<typename T>
void g() {
T instance;

  f<int>();

}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See godbolt: https://godbolt.org/z/r57fM9fbq


Stack Dump:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<source>: In function 'void g()':
<source>:6:9: internal compiler error: in break_out_target_exprs, at
cp/tree.cc:3339
    6 |   f<int>();
      |   ~~~~~~^~
0x287f965 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x28a1646 internal_error(char const*, ...)
        ???:0
0xaf4a8c fancy_abort(char const*, int, char const*)
        ???:0
0xb150fc convert_default_arg(tree_node*, tree_node*, tree_node*, int, int)
        ???:0
0xe0241a cp_build_function_call_vec(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int, tree_node*)
        ???:0
0xb2cacc build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0xda42ec finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0xd219a3 c_parse_file()
        ???:0
0xe8bfe9 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.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to