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

            Bug ID: 123488
           Summary: ICE: in gimplify_expr, at gimplify.cc during explicit
                    destructor call of unrelated template in a template
                    function
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 522024330006 at smail dot nju.edu.cn
  Target Milestone: ---

To reproduce: https://godbolt.org/z/EMbdPd1v9

```c
#include <vector>

template<int N> struct T {};
template<typename U, int Val>
struct C {
    void op() const { 
        T<Val>::~T(); 
    }
};

void parse() {
    C<int*, 0> inst;
    // The ICE occurs when the compiler attempts to generate code for this
call.
    inst.op();
}
```

Part of the traceback:
```
internal compiler error: in gimplify_expr, at gimplify.cc:21464
   12 |         T<Val>::~T();
      |         ^
0x291af48 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x290fd0b internal_error(char const*, ...)
        ???:0
0xb13d66 fancy_abort(char const*, int, char const*)
        ???:0
0x11c0cbd gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0x11c2cb2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0x11c111a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0x11c1e37 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0x11e5e86 gimplify_body(tree_node*, bool)
        ???:0
0x11e634c gimplify_function_tree(tree_node*)
        ???:0
0xf9d1a7 cgraph_node::analyze()
        ???:0
0xfa0621 symbol_table::finalize_compilation_unit()
        ???: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