Files
gcc-reflection/gcc/testsuite/g++.dg/cpp1z/array-prvalue3.C
Jason Merrill ed63cd2aa5 c++: deleting array temporary [PR115187]
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.
2024-05-23 16:23:39 -04:00

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 }
}