[PATCH] PR libstdc++/89164 enforce constraints for uninitialized algos
Jonathan Wakely
jwakely@redhat.com
Fri Aug 30 16:19:00 GMT 2019
On 30/08/19 14:54 +0100, Jonathan Wakely wrote:
>The memmove optimizations for std::uninitialized_copy/fill/_n will
>compile even if the type is not copy constructible, because std::copy
>doesn't require copy construction to work. But the uninitialized
>algorithms do require it.
>
>This adds explicit static assertions to ensure we don't allow ill-formed
>initializations.
>
> PR libstdc++/89164
> * include/bits/stl_algobase.h (__copy_move): Give descriptive names
> to template parameters.
> * include/bits/stl_uninitialized.h (uninitialized_copy)
> (uninitialized_fill, uninitialized_fill_n): Add static assertions to
> diagnose invalid uses.
> * testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc:
> Adjust expected error.
> * testsuite/20_util/specialized_algorithms/uninitialized_copy/89164.cc:
> New test.
> * testsuite/20_util/specialized_algorithms/uninitialized_copy_n/
> 89164.cc: New test.
> * testsuite/20_util/specialized_algorithms/uninitialized_fill/89164.cc:
> New test.
> * testsuite/20_util/specialized_algorithms/uninitialized_fill_n/
> 89164.cc: New test.
> * testsuite/23_containers/vector/cons/89164.cc: New test.
> * testsuite/23_containers/vector/cons/89164_c++17.cc: New test.
>
>This is the patch sent in
>https://gcc.gnu.org/ml/libstdc++/2019-02/msg00034.html but with the
>dg-error directives in the tests fixed.
>
>Tested x86_64-linux, committed to trunk.
Oops, looks like what I tested didn't have the new test checked in.
This fixes it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 702 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190830/6232aa06/attachment.bin>
More information about the Libstdc++
mailing list