On 2/19/20 10:15 PM, Marek Polacek wrote:
On Fri, Feb 14, 2020 at 12:24:30AM +0100, Jason Merrill wrote:
On 2/11/20 8:54 PM, Marek Polacek wrote:
Since <https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00556.html> we
attempt to value-initialize in build_vec_init even when there's no
initializer but the type has a constexpr default constructor. But
build_value_init doesn't work in templates, so I think let's avoid
this scenario; we'll go to the normal build_aggr_init path then.
Bootstrapped/regtested on x86_64-linux, ok for trunk and branches?
PR c++/93676 - value-init crash in template.
* init.c (build_vec_init): Don't perform value-init in a template.
Hmm, we really shouldn't even be calling build_vec_init in a template, that
builds up a lot of garbage that we'll throw away at the end of build_new.
Ah, it's true that build_new will just creates a NEW_EXPR in a template and
doesn't use the result of build_new_1. Unfortunately I can't just call
build_special_member_call like we do in build_new_1 since that crashes for
array types.
We should call it for strip_array_types (type).
Jason