[Bug c++/94124] [10 Regression] conversion from ‘<brace-enclosed initializer list>’ to ‘F’ is ambiguous since r10-6388-ge98ebda074bf8fc5
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 12 08:12:24 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94124
--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
commit r10-7139-g4069adf4bbc90d16b603e0308b48499c36b2b637
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Mar 12 08:28:05 2020 +0100
c++: Tweak reshape_init_array_1 [PR94124]
Isn't it wasteful to first copy perhaps a large constructor (recursively)
and then truncate it to very few elts (zero in this case)?
> We should certainly avoid copying if they're the same. The code above
for
> only copying the bits that aren't going to be thrown away seems pretty
> straightforward, might as well use it even if the savings aren't likely
to
> be large.
Calling vec_safe_truncate with the same number of elts the vector already
has is a nop, so IMHO we just should make sure we only unshare if it
changed.
2020-03-12 Jakub Jelinek <jakub@redhat.com>
PR c++/94124
* decl.c (reshape_init_array_1): Don't unshare constructor if there
aren't any trailing zero elts, otherwise only unshare the first
nelts.
More information about the Gcc-bugs
mailing list