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

            Bug ID: 124816
           Summary: ICE Segmentation fault in template member function
                    inside incomplete template class
           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: ---

Simplified test:

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

struct incomplete_1 {


template<incomplete_1>
struct incomplete_2 {

template<typename>
void foo() {
}

int main() {
  foo<int>();
}

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


Stack dump:


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

<source>: In substitution of 'template<<typeprefixerror><anonymous> >
template<class> void incomplete_1::incomplete_2<<anonymous> >::foo() [with
<template-parameter-2-1> = <missing>; <typeprefixerror><anonymous> = int]':
<source>:12:11:   required from here
   12 |   foo<int>();
      |   ~~~~~~~~^~
<source>:12:11: internal compiler error: Segmentation fault
0x296c9c8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x296160b internal_error(char const*, ...)
        ???:0
0xb6f290 pop_nested_class()
        ???:0
0xdc68f3 instantiate_template(tree_node*, tree_node*, int)
        ???:0
0xdd7dba fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ???:0
0xb4590b build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ???:0
0xe1102c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0xd71fb3 c_parse_file()
        ???:0
0xefd709 c_common_parse_file()
        ???:0
/cefs/ce/cedf938806e725cf9a6df4ce_gcc-trunk-20260408/bin/../libexec/gcc/x86_64-linux-gnu/16.0.1/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/ce/cedf938806e725cf9a6df4ce_gcc-trunk-20260408/bin/../lib/gcc/x86_64-linux-gnu/16.0.1/
-D_GNU_SOURCE <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext
.cpp -masm=intel -mtune=generic -march=x86-64 -g -fdiagnostics-color=always
-fno-verbose-asm -o /app/output.s
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.

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

See godbolt: https://godbolt.org/z/1vxsqh47T

Reply via email to