diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-01-15 16:49:19 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-01-15 16:49:19 -0500 |
commit | d33c3b5ac9b9b3e314ae9118d483ade7e91a80a5 (patch) | |
tree | b2df70ed23150fae805f2bcbdbef25f6a8d5af58 /gcc/cp | |
parent | 2d55d94e5df3890400dd40e601c93ae5d468b24c (diff) | |
download | gcc-d33c3b5ac9b9b3e314ae9118d483ade7e91a80a5.zip gcc-d33c3b5ac9b9b3e314ae9118d483ade7e91a80a5.tar.gz gcc-d33c3b5ac9b9b3e314ae9118d483ade7e91a80a5.tar.bz2 |
c++: non-dep array list-init w/ non-triv dtor [PR109899]
The get_target_expr call added in r12-7069-g119cea98f66476 causes us
for the below testcase to call build_vec_delete in a template context,
which builds a templated destructor call and checks expr_noexcept_p for
it, which ICEs because the call has templated form.
Much of the work of build_vec_delete however is code generation and thus
will just get discarded in a template context, and that includes the
code guarded by expr_noexcept_p. So this patch narrowly fixes this ICE
by eliding the expr_noexcept_p call when in a template context.
PR c++/109899
gcc/cp/ChangeLog:
* init.cc (build_vec_delete_1): Assume expr_noexcept_p returns
false in a template context.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/initlist-array21.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/init.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc index bbcd187..adbdfc2 100644 --- a/gcc/cp/init.cc +++ b/gcc/cp/init.cc @@ -4155,7 +4155,8 @@ build_vec_delete_1 (location_t loc, tree base, tree maxindex, tree type, /* If one destructor throws, keep trying to clean up the rest, unless we're already in a build_vec_init cleanup. */ - if (flag_exceptions && !in_cleanup && !expr_noexcept_p (tmp, tf_none)) + if (flag_exceptions && !in_cleanup && !processing_template_decl + && !expr_noexcept_p (tmp, tf_none)) { loop = build2 (TRY_CATCH_EXPR, void_type_node, loop, unshare_expr (loop)); |