]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: ICE with VEC_INIT_EXPR and defarg [PR106925]
authorMarek Polacek <polacek@redhat.com>
Tue, 11 Oct 2022 18:16:54 +0000 (14:16 -0400)
committerMarek Polacek <polacek@redhat.com>
Thu, 13 Oct 2022 15:08:57 +0000 (11:08 -0400)
commit8794633003318113e03147a727e63f5d55b350ab
tree2de72c8fef2225e399bbb17f30a220423c8c2634
parentc886562a0f9c0c7153bccf1cde948bba05bd3cd9
c++: ICE with VEC_INIT_EXPR and defarg [PR106925]

Since r12-8066, in cxx_eval_vec_init we perform expand_vec_init_expr
while processing the default argument in this test.  At this point
start_preparsed_function hasn't yet set current_function_decl.
expand_vec_init_expr then leads to maybe_splice_retval_cleanup which
checks DECL_CONSTRUCTOR_P (current_function_decl) without checking that
c_f_d is non-null first.  It seems correct that c_f_d is null here, so
it seems to me that maybe_splice_retval_cleanup should check c_f_d as
in the following patch.

PR c++/106925

gcc/cp/ChangeLog:

* except.cc (maybe_splice_retval_cleanup): Check current_function_decl.
Make the bool const.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/initlist-defarg3.C: New test.

(cherry picked from commit 3130e70dab1e64a7b014391fe941090d5f3b6b7d)
gcc/cp/except.cc
gcc/testsuite/g++.dg/cpp0x/initlist-defarg3.C [new file with mode: 0644]