[Bug c++/115645] [11/12/13/14/15 Regression] new S[1][1]() requires non-explicit default ctor since r11-3092
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 10 16:36:17 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115645
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:fde96e8205f343e6471a11cc9def967bb5dd5362
commit r15-1946-gfde96e8205f343e6471a11cc9def967bb5dd5362
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Jul 2 15:22:39 2024 -0400
c++: array new with value-initialization [PR115645]
This extends the r11-5179 fix which doesn't work with multidimensional
arrays. In particular,
struct S {
explicit S() { }
};
auto p = new S[1][1]();
should not say "converting to S from initializer list would use
explicit constructor" because there's no {}. However, since we
went into the block where we create a {}, we got confused. We
should not have gotten there but we did because array_p was true.
This patch refines the check once more.
PR c++/115645
gcc/cp/ChangeLog:
* init.cc (build_new): Don't do any deduction for arrays with
bounds if it's value-initialized.
gcc/testsuite/ChangeLog:
* g++.dg/expr/anew7.C: New test.
More information about the Gcc-bugs
mailing list