https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89164

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Fri Aug 30 13:54:49 2019
New Revision: 275177

URL: https://gcc.gnu.org/viewcvs?rev=275177&root=gcc&view=rev
Log:
PR libstdc++/89164 enforce constraints for uninitialized algos

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.

Added:
   
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/89164.cc
      - copied, changed from r275063,
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc
   
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/89164.cc
      - copied, changed from r275063,
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc
   
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/89164.cc
      - copied, changed from r275063,
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc
   
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill_n/89164.cc
      - copied, changed from r275063,
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc
    trunk/libstdc++-v3/testsuite/23_containers/vector/cons/89164.cc
      - copied, changed from r275063,
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc
    trunk/libstdc++-v3/testsuite/23_containers/vector/cons/89164_c++17.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/stl_algobase.h
    trunk/libstdc++-v3/include/bits/stl_uninitialized.h
   
trunk/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc

Reply via email to