[Bug libstdc++/99006] make_shared<T[]> silently works
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jun 18 12:56:24 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99006
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:36d6e7fe997aa85dc64b13ce4bb3c2e51e13cd36
commit r10-9936-g36d6e7fe997aa85dc64b13ce4bb3c2e51e13cd36
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Apr 22 15:46:51 2021 +0100
libstdc++: Reject std::make_shared<T[]> [PR 99006]
Prior to C++20 it should be ill-formed to use std::make_shared with an
array type (and we don't support the C++20 feature to make it valid yet
anyway).
libstdc++-v3/ChangeLog:
PR libstdc++/99006
* include/bits/shared_ptr.h (allocate_shared): Assert that _Tp
is not an array type.
* include/bits/shared_ptr_base.h (__allocate_shared): Likewise.
* testsuite/20_util/shared_ptr/creation/99006.cc: New test.
(cherry picked from commit 55650236cd97d81f42f9fdb4f6bcb12babafe51f)
More information about the Gcc-bugs
mailing list