ead408529d
While laying some groundwork for constexpr std::vector, I noticed some bugs in the std::uninitialized_xxx algorithms. The conditions being checked for optimizing trivial cases were not quite right, as shown in the examples in the PR. This consolidates the checks into a single macro. The macro has appropriate definitions for C++98 or for later standards, to avoid a #if everywhere the checks are used. For C++11 and later the check makes a call to a new function doing a static_assert to ensure we don't use assignment in cases where construction would have been invalid. Extracting that check to a separate function will be useful for constexpr std::vector, as that can't use std::uninitialized_copy directly because it isn't constexpr). The consolidated checks mean that some slight variations in static assert message are gone, as there is only one place that does the assert now. That required adjusting some tests. As part of that the redundant 89164_c++17.cc test was merged into 89164.cc which is compiled as C++17 by default now, but can also use other -std options if the C++17-specific error is made conditional with a target selector. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/102064 * include/bits/stl_uninitialized.h (_GLIBCXX_USE_ASSIGN_FOR_INIT): Define macro to check conditions for optimizing trivial cases. (__check_constructible): New function to do static assert. (uninitialized_copy, uninitialized_fill, uninitialized_fill_n): Use new macro. * testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc: Adjust dg-error pattern. * testsuite/23_containers/vector/cons/89164.cc: Likewise. Add C++17-specific checks from 89164_c++17.cc. * testsuite/23_containers/vector/cons/89164_c++17.cc: Removed. * testsuite/20_util/specialized_algorithms/uninitialized_copy/102064.cc: New test. * testsuite/20_util/specialized_algorithms/uninitialized_copy_n/102064.cc: New test. * testsuite/20_util/specialized_algorithms/uninitialized_fill/102064.cc: New test. * testsuite/20_util/specialized_algorithms/uninitialized_fill_n/102064.cc: New test. |
||
---|---|---|
.. | ||
config | ||
doc | ||
include | ||
libsupc++ | ||
po | ||
python | ||
scripts | ||
src | ||
testsuite | ||
acinclude.m4 | ||
aclocal.m4 | ||
ChangeLog | ||
ChangeLog-1998 | ||
ChangeLog-1999 | ||
ChangeLog-2000 | ||
ChangeLog-2001 | ||
ChangeLog-2002 | ||
ChangeLog-2003 | ||
ChangeLog-2004 | ||
ChangeLog-2005 | ||
ChangeLog-2006 | ||
ChangeLog-2007 | ||
ChangeLog-2008 | ||
ChangeLog-2009 | ||
ChangeLog-2010 | ||
ChangeLog-2011 | ||
ChangeLog-2012 | ||
ChangeLog-2013 | ||
ChangeLog-2014 | ||
ChangeLog-2015 | ||
ChangeLog-2016 | ||
ChangeLog-2017 | ||
ChangeLog-2018 | ||
ChangeLog-2019 | ||
ChangeLog-2020 | ||
config.h.in | ||
configure | ||
configure.ac | ||
configure.host | ||
crossconfig.m4 | ||
fragment.am | ||
linkage.m4 | ||
Makefile.am | ||
Makefile.in | ||
README |
file: libstdc++-v3/README New users may wish to point their web browsers to the file index.html in the 'doc/html' subdirectory. It contains brief building instructions and notes on how to configure the library in interesting ways.