mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 20:01:31 -05:00
Decaying the array temporary to a pointer and then deleting that crashes in verify_gimple_stmt, because the TARGET_EXPR is first evaluated inside the TRY_FINALLY_EXPR, but the cleanup point is outside. Fixed by using get_target_expr instead of save_expr. I also adjust the stabilize_expr comment to prevent me from again thinking it's a suitable replacement. PR c++/115187 gcc/cp/ChangeLog: * init.cc (build_delete): Use get_target_expr instead of save_expr. * tree.cc (stabilize_expr): Update comment. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/array-prvalue3.C: New test.
9 lines
205 B
C
9 lines
205 B
C
// PR c++/115187
|
|
// { dg-do compile { target c++17 } }
|
|
|
|
void f() {
|
|
using T = int[2];
|
|
delete T{}; // { dg-warning "deleting array" }
|
|
// { dg-warning "unallocated object" "" { target *-*-* } .-1 }
|
|
}
|