https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82235
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Some debugging notes. We're synthesizing the Bar::Bar(const Bar&) constructor in do_build_copy_constructor which creates a list of Bar's fields along with their initializers. Here we have m D.2398->m because we're initializing m from m of a copy. We pass this list down to finish_mem_initializers, which passes each pair to perform_member_init. perform_member_init sees that we're initializing an array so creates a VEC_INIT_EXPR via build_vec_init_expr. VEC_INIT_EXPRs are expanded in cp_gimplify_expr, so we call build_vec_init to do so. We're initializing an array from another array and so do 4508 else if (type_build_ctor_call (type)) 4509 elt_init = build_aggr_init (to, from, 0, complain) where to = *D.2445 and from = *D.2447. and build_aggr_init has 1822 if (init && init != void_type_node 1823 && TREE_CODE (init) != TREE_LIST 1824 && !(TREE_CODE (init) == TARGET_EXPR 1825 && TARGET_EXPR_DIRECT_INIT_P (init)) 1826 && !DIRECT_LIST_INIT_P (init)) 1827 flags |= LOOKUP_ONLYCONVERTING; and init is an indirect_ref so we set L_O, never realizing that in this case we don't want to set L_O. I suppose we could introduce VEC_INIT_EXPR_DIRECT_INIT_P, set it in perform_member_init, and then use it in cp_gimplify_expr to let build_aggr_init know not to set L_O. Because cp_gimplify_expr can't know in what context the VEC_INIT_EXPR was created.