[committed] libstdc++: Revert changes to std::unique_ptr<T[]>::operator[] [PR 101271]
Jonathan Wakely
jwakely@redhat.com
Fri Jul 2 11:16:43 GMT 2021
On 28/06/21 14:24 +0100, Jonathan Wakely wrote:
>PR libstdc++/101236 shows that LLVM depends on being able to use
>unique_ptr<T[]>::operator[] when T is incomplete. This is undefined, but
>previously worked with libstdc++. When I added the conditional noexcept
>to that operator we started to diagnose the incomplete type.
>
>This change restores support for that case, by making the noexcept
>condition check that the type is complete before checking whether
>indexing on the pointer can throw. A workaround for PR c++/101239 is
>needed to avoid a bogus error where G++ fails to do SFINAE on the
>ill-formed p[n] expression and gets an ICE. Instead of checking that the
>p[n] expression is valid in the trailing-return-type, we only check that
>the element_type is complete.
>
>libstdc++-v3/ChangeLog:
>
> PR libstdc++/101236
> * include/bits/unique_ptr.h (unique_ptr<T[], D>::operator[]):
> Fail gracefully if element_type is incomplete.
> * testsuite/20_util/unique_ptr/cons/incomplete.cc: Clarify that
> the standard doesn't require this test to work for array types.
> * testsuite/20_util/unique_ptr/lwg2762.cc: Check that incomplete
> types can be used with array specialization.
> * testsuite/20_util/unique_ptr/101236.cc: New test.
This (and the previous change that it tried to fix) needs to be
reverted, as attached.
Tested powerpc64le-linux. Committed to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 4164 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210702/6fd02b0b/attachment.bin>
More information about the Libstdc++
mailing list