aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
AgeCommit message (Collapse)Author
2020-01-10libstdc++: Improve comment about testsuite utilitiesJonathan Wakely
This fixes a typo and also explains why test_container is not a range when used with output_iterator_wrapper or input_iterator_wrapper. * testsuite/util/testsuite_iterators.h: Improve comment. From-SVN: r280146
2020-01-10libstdc++: Fix testcase for C++98 compatibilityJonathan Wakely
* testsuite/25_algorithms/equal/deque_iterators/1.cc: Don't use C++11 initialization syntax. From-SVN: r280117
2020-01-10libstdc++: Make istreambuf_iterator base class consistent (PR92285)Jonathan Wakely
Since LWG 445 was implemented for GCC 4.7, the std::iterator base class of std::istreambuf_iterator changes type depending on the -std mode used. This creates an ABI incompatibility between different -std modes. This change ensures the base class always has the same type. This makes layout for C++98 compatible with the current -std=gnu++14 default, but no longer compatible with C++98 code from previous releases. In practice this is unlikely to cause real problems, because it only affects the layout of types with two std::iterator base classes, one of which comes from std::istreambuf_iterator. Such types are expected to be vanishingly rare. PR libstdc++/92285 * include/bits/streambuf_iterator.h (istreambuf_iterator): Make type of base class independent of __cplusplus value. [__cplusplus < 201103L] (istreambuf_iterator::reference): Override the type defined in the base class * testsuite/24_iterators/istreambuf_iterator/92285.cc: New test. * testsuite/24_iterators/istreambuf_iterator/requirements/ base_classes.cc: Adjust expected base class for C++98. From-SVN: r280116
2020-01-09rename local _C2 identifiers in stl map header filesOlivier Hainque
2020-01-09 Olivier Hainque <hainque@adacore.com> * doc/xml/manual/appendix_contributing.xml: Document _C2 as a reserved identifier, by VxWorks. * include/bits/stl_map.h: Rename _C2 template typenames as _Cmp2. * include/bits/stl_multimap.h: Likewise. From-SVN: r280076
2020-01-09libstdc++: Fix <ext/pointer.h> incompatibilities with C++20Jonathan Wakely
The equality operators for _ExtPtr_allocator are defined as non-const member functions, which causes ambiguities in C++20 due to the synthesized operator!= candidates. They should always have been const. The _Pointer_adapter class template has both value_type and element_type members, which makes readable_traits<_Pointer_adapter<T>> ambiguous. The intended workaround is to add a specialization of readable_traits. * include/ext/extptr_allocator.h (_ExtPtr_allocator::operator==) (_ExtPtr_allocator::operator!=): Add missing const qualifiers. * include/ext/pointer.h (readable_traits<_Pointer_adapter<S>>): Add partial specialization to disambiguate the two constrained specializations. From-SVN: r280067
2020-01-09libstdc++: Fix testsuite failures and warnings due to is_pod deprecationJonathan Wakely
With -std=gnu++2a and -Wsystem-headers the std::is_pod deprecation causes some new diagnostics. This suppresses them. * include/experimental/type_traits (experimental::is_pod_v): Disable -Wdeprecated-declarations warnings around reference to std::is_pod. * include/std/type_traits (is_pod_v): Likewise. * testsuite/18_support/max_align_t/requirements/2.cc: Also check is_standard_layout and is_trivial. Do not check is_pod for C++20. * testsuite/20_util/is_pod/requirements/explicit_instantiation.cc: Add -Wno-deprecated for C++20. * testsuite/20_util/is_pod/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_pod/value.cc: Likewise. * testsuite/experimental/type_traits/value.cc: Likewise. From-SVN: r280066
2020-01-09libstdc++: Implementing P0767 - deprecate PODJeanHeyd "ThePhD" Meneide
This adds the deprecated attribute to std::is_pod and std::is_pod_v for C++20. 2019-12-05 JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com> * include/bits/c++config (_GLIBCXX20_DEPRECATED): Add new macro. * include/std/type_traits (is_pod, is_pod_v): Deprecate for C++20. * testuite/20_util/is_pod/deprecated-2a.cc: New test. From-SVN: r280065
2020-01-09libstdc++: Fix whitespace in ChangeLog-2019Jonathan Wakely
From-SVN: r280064
2020-01-09libstdc++: Fix undefined behaviour in random dist serialization (PR93205)Jonathan Wakely
The deserialization functions for random number distributions fail to check the stream state before using the extracted values. In some cases this leads to using indeterminate values to resize a vector, and then filling that vector with indeterminate values. No values that affect control flow should be used without checking that a good value was read from the stream. Additionally, where reasonable to do so, defer modifying any state in the distribution until all values have been successfully read, to avoid modifying some of the distribution's parameters and leaving others unchanged. PR libstdc++/93205 * include/bits/random.h (operator>>): Check stream operation succeeds. * include/bits/random.tcc (operator<<): Remove redundant __ostream_type typedefs. (operator>>): Remove redundant __istream_type typedefs. Check stream operations succeed. (__extract_params): New function to fill a vector from a stream. * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error line. From-SVN: r280061
2020-01-09libstdc++: Define memory resource key functions non-inline (PR93208)Jonathan Wakely
This prevents the vtables and RTTI from being emitted in every object file that uses memory_resource and monotonic_buffer_resource. Objects compiled by GCC 9.1 or 9.2 will contain inline definitions of the destructors, vtable and RTTI, but this is harmless. The inline definitions have identical effects to the ones that are now defined in libstdc++.so so it doesn't matter if the inline ones are used instead of calling the symbols exported from the runtime library. PR libstdc++/93208 * config/abi/pre/gnu.ver: Add new exports. * include/std/memory_resource (memory_resource::~memory_resource()): Do not define inline. (monotonic_buffer_resource::~monotonic_buffer_resource()): Likewise. * src/c++17/memory_resource.cc (memory_resource::~memory_resource()): Define. (monotonic_buffer_resource::~monotonic_buffer_resource()): Define. * testsuite/20_util/monotonic_buffer_resource/93208.cc: New test. From-SVN: r280044
2020-01-09PR libstdc++/92124 fix incorrect unordered container move assignmentFrançois Dumont
* include/bits/hashtable.h (_Hashtable<>::__alloc_node_gen_t): New template alias. (_Hashtable<>::__fwd_value_for): New. (_Hashtable<>::_M_assign_elements<>): Remove _NodeGenerator template parameter. (_Hashtable<>::_M_assign<>): Add _Ht template parameter. (_Hashtable<>::operator=(const _Hashtable<>&)): Adapt. (_Hashtable<>::_M_move_assign): Adapt. Replace std::move_if_noexcept with std::move. (_Hashtable<>::_Hashtable(const _Hashtable&)): Adapt. (_Hashtable<>::_Hashtable(const _Hashtable&, const allocator_type&)): Adapt. (_Hashtable<>::_Hashtable(_Hashtable&&, const allocator_type&)): Adapt. * testsuite/23_containers/unordered_set/92124.cc: New. From-SVN: r280028
2020-01-08libstdc++: Fix error handling in filesystem::remove_all (PR93201)Jonathan Wakely
When recursing into a directory, any errors that occur while removing a directory entry are ignored, because the subsequent increment of the directory iterator clears the error_code object. This fixes that bug by checking the result of each recursive operation before incrementing. This is a change in observable behaviour, because previously other directory entries would still be removed even if one (or more) couldn't be removed due to errors. Now the operation stops on the first error, which is what the code intended to do all along. The standard doesn't specify what happens in this case (because the order that the entries are processed is unspecified anyway). It also improves the error reporting so that the name of the file that could not be removed is included in the filesystem_error exception. This is done by introducing a new helper type for reporting errors with additional context and a new function that uses that type. Then the overload of std::filesystem::remove_all that throws an exception can use the new function to ensure any exception contains the additional information. For std::experimental::filesystem::remove_all just fix the bug where errors are ignored. PR libstdc++/93201 * src/c++17/fs_ops.cc (do_remove_all): New function implementing more detailed error reporting for remove_all. Check result of recursive call before incrementing iterator. (remove_all(const path&), remove_all(const path&, error_code&)): Use do_remove_all. * src/filesystem/ops.cc (remove_all(const path&, error_code&)): Check result of recursive call before incrementing iterator. * testsuite/27_io/filesystem/operations/remove_all.cc: Check errors are reported correctly. * testsuite/experimental/filesystem/operations/remove_all.cc: Likewise. From-SVN: r280014
2020-01-08Rename condition_variable_any wait* methods to match current draft standardThomas Rodgers
2020-01-07 Thomas Rodgers <trodgers@redhat.com> * include/std/condition_variable (condition_variable_any::wait_on): Rename to match current draft standard. (condition_variable_any::wait_on_until): Likewise. (condition_variable_any::wait_on_for): Likewise. * testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc: Adjust tests to account for renamed methods. From-SVN: r279988
2020-01-07PR libstdc++/92124 fix incorrect container move assignmentFrançois Dumont
* include/bits/stl_tree.h (_Rb_tree<>::_M_move_assign(_Rb_tree&, false_type)): Replace std::move_if_noexcept by std::move. * testsuite/23_containers/map/92124.cc: New. * testsuite/23_containers/set/92124.cc: New. From-SVN: r279967
2020-01-06libstdc++: Remove redundant inequality operators in <stop_token>Jonathan Wakely
* include/std/stop_token (stop_token): Remove operator!= (LWG 3254). (stop_source): Likewise (LWG 3362). * testsuite/30_threads/stop_token/stop_source.cc: Test equality comparisons. From-SVN: r279897
2020-01-06libstdc++: Define __cpp_lib_three_way_comparison conditionallyJonathan Wakely
The contents of the <compare> header are not complete unless concepts are supported, so the feature test macro should depend on the macro for concepts. As a result, the std::lexicographical_compare_three_way function will not be defined unless concepts are supported, so there is no need to check __cpp_lib_concepts before using concepts in those functions. * include/bits/stl_algobase.h (__is_byte_iter, __min_cmp) (lexicographical_compare_three_way): Do not depend on __cpp_lib_concepts. * include/std/version (__cpp_lib_three_way_comparison): Only define when __cpp_lib_concepts is defined. * libsupc++/compare (__cpp_lib_three_way_comparison): Likewise. From-SVN: r279896
2020-01-03libstdc++: Only use std::compare_three_way when concepts are supportedJonathan Wakely
Clang now supports three-way comparisons. That causes both overloads of std::lexicographical_compare_three_way to be defined, but the second one uses std::compare_three_way which depends on concepts. Clang does not yet support concepts, so the second overload should also depend on __cpp_lib_concepts. * include/bits/stl_algobase.h (lexicographical_compare_three_way): Only define four-argument overload when __cpp_lib_concepts is defined. From-SVN: r279861
2020-01-01baseline_symbols.txt: Update.John David Anglin
* config/abi/post/hppa-linux-gnu/baseline_symbols.txt: Update. From-SVN: r279816
2020-01-01Update copyright years.Jakub Jelinek
From-SVN: r279813
2019-12-30VxWorks has_nanosleep for libstdc++ enable-libstdcxx-time autoCorentin Gay
2019-12-30 Corentin Gay <gay@adacore.com> * acinclude.m4 (vxworks*): New entry. Set ac_has_nanosleep=yes. * configure: Regenerate. From-SVN: r279796
2019-12-30Adapt libstdc++ os_defines for VxWorks to more recent versionsJerome Lambourg
This change reworks the VxWorks specific os_defines.h internal lisbstdc++ header to help fix build and runtime failures of various kinds in environments from 6.4/6.9 to 7 SR640, based on experiments and observations conducted against real installs of these OSes for different CPU architectures. 2019-12-30 Jerome Lambourg <lambourg@adacore.com> Olivier Hainque <hainque@adacore.com> libstdc++ * config/os/vxworks/os_defines.h (NOMINMAX): Always redefine to 1. (_NO_CPP_INLINES): Likewise. (_GLIBCXX_USE_WEAK_REF): Define to 1 for RTP on VxWorks >= 7, to 0 otherwise. (_GLIBCXX_HAVE_TLS): Define to 1. For VxWorks >= 7: (_GLIBCXX_USE_C99_MATH): Define to 1. (_GLIBCXX_USE_C99_MATH_FP_MACROS_DYNAMIC): Define to 0. (_HAS_TR1_DECLARATIONS): Redefine to 0. For VxWorks < 7, RTP: (_GLIBCXX_INCLUDE_NEXT_C_HEADERS): Define to 1. (_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC): Redefine to 1. (__CORRECT_ISO_CPP11_MATH_H_PROTO_FP): Define. For VxWorks < 7, kernel: #include <vxWorks.h> Co-Authored-By: Olivier Hainque <hainque@adacore.com> From-SVN: r279792
2019-12-25Define HAVE_ for math long double functions declared in vxworks headersAlexandre Oliva
When cross-building for vxworks, test for declarations of long double functions in math.h. We don't normally test for these functions when cross compiling, because link tests don't work, or ever really, but not defining them as available causes replacements to be defined in ways that may cause duplicate definition linker errors if the units defining both the replacement and the actual implementation are brought in because of other symbols. for libstdc++-v3/ChangeLog * crossconfig.m4 (GLIBCXX_CROSSCONFIG) [*-vxworks*]: Define long double functions as available if declared by math.h. (GLIBCXX_CHECK_MATH_DECL, GLIBCXX_CHECK_MATH_DECLS): New. * configure: Rebuild. From-SVN: r279731
2019-12-20libstdc++: Add inline to maybe-constexpr functions (PR 92927)Jonathan Wakely
Originally these functions were always inline. I changed them in r277342 to be always constexpr, then in r277588 changed them to be constexpr for C++14, but I didn't restore the 'inline' for C++11. That leads to linker errors when libstdc++.so is built unoptimized, because those functions don't get instantiated in src/c++11/string-inst.o PR libstdc++/92927 * include/bits/alloc_traits.h (__alloc_on_copy, __alloc_on_move) (__alloc_on_swap): Add inline specifier. From-SVN: r279656
2019-12-20libstdc++: Test setrlimit with c++ in configureJerome Lambourg
* acinclude.m4 (GLIBCXX_CHECK_SETRLIMIT): Test with AC_LANG_CPLUSPLUS. * configure: Regenerate. From-SVN: r279644
2019-12-20libstdc++: Fix versioned namespace testsFrançois Dumont
* testsuite/23_containers/map/48101_neg.cc: Add versioned namespace pattern to tested error message. * testsuite/23_containers/multimap/48101_neg.cc: Likewise. * testsuite/30_threads/headers/stop_token/synopsis.cc: Add dg-require-normal-namepace. From-SVN: r279641
2019-12-20libstdc++: Fix pretty printers script and testsFrançois Dumont
* python/libstdcxx/v6/printers.py (lookup_node_type): Remove redundant call to lookup_node_type. * testsuite/libstdc++-prettyprinters/80276.cc: Define _GLIBCXX_USE_CXX11_ABI to 0. * testsuite/libstdc++-prettyprinters/91997.cc: Use regexp-test to check 'a' content. From-SVN: r279640
2019-12-20libstdc++: Strengthen the check for availability of pthread_rwlock_tJerome Lambourg
* acinclude.m4 (_GLIBCXX_USE_PTHREAD_RWLOCK_T): Checks that _PTHREADS is defined after including gthr.h. * configure: Regenerate. From-SVN: r279635
2019-12-12libstdc++: Simplify std::common_comparison_categoryJonathan Wakely
* libsupc++/compare (common_comparison_category): Define without using concepts and optimise for compilation time. (__detail::__cmp_cat_ids): Remove. (__detail::__common_cmp_cat): Replace class template and specializations with constexpr function. From-SVN: r279307
2019-12-12libstdc++: Fix tr1 definition ambiguity in versioned namespaceFrançois Dumont
* include/tr1/cctype: Add _GLIBCXX_BEGIN_VERSION_NAMESPACE and _GLIBCXX_END_VERSION_NAMESPACE. * include/tr1/cfenv: Likewise. * include/tr1/cinttypes: Likewise. * include/tr1/cstdint: Likewise. * include/tr1/cstdio: Likewise. * include/tr1/cstdlib: Likewise. * include/tr1/cwchar: Likewise. * include/tr1/cwctype: Likewise. From-SVN: r279272
2019-12-12libstdc++: Qualify isdigit call to fix versioned namespace build.François Dumont
* src/c++11/random.cc: Include <cctype>. (random_devise::_M_init_pretr1): Qualify isdigit call. From-SVN: r279271
2019-12-11libstdc++: Fix whitepace in changelogJonathan Wakely
From-SVN: r279220
2019-12-11Restore enable_if lost during original import of pstlThomas Rodgers
* include/pstl/glue_numeric_defs.h: Restore enable_if lost during original import of pstl. * include/pstl/glue_numeric_impl.h: Likewise. From-SVN: r279212
2019-12-10libstdc++: Correct noexcept-specifiers on span constructorsJonathan Wakely
As discussed at https://github.com/cplusplus/draft/issues/3534 two std::span constructors specify incorrect conditions for throwing exceptions. This patch makes those constructors have correct noexcept-specifiers that accurately reflect what can actually throw. (span(ContiguousIterator, Sentinel)): Add conditional noexcept. * include/std/span (span(ContiguousIterator, size_type)): Change noexcept to be unconditionally true. * testsuite/23_containers/span/nothrow_cons.cc: New test. From-SVN: r279206
2019-12-10libstdc++: Rework std::copy/copy_backward/move/move_backward/fill/fill_n algosFrançois Dumont
Enhance those algos overloads to generalize existing optimization for __gnu_debug::_Safe_iterator w/o _GLIBCXX_DEBUG mode and for std::deque iterators. Also extend __copy_move_a2 ostreambuf_iterator overloads to std::vector and std::deque iterators. * include/bits/stl_algobase.h (__copy_move_a1<>(_II, _II, _OI)): New. (__copy_move_a1<>(_Deque_iterator<>, _Deque_iterator<>, _OI)): New. (__copy_move_a1<>(_Deque_iterator<>, _Deque_iterator<>, _Deque_iterator<>)): New. (__copy_move_a1<>(_II, _II, _Deque_iterator<>)): New. (__copy_move_a<>(_II, _II, _OI)): Adapt, call __copy_move_a1<>. (__copy_move_a<>(const _Safe_iterator<>&, const _Safe_iterator<>&, _OI)): New. (__copy_move_a<>(const _Safe_iterator<>&, const _Safe_iterator<>&, const _Safe_iterator<>&)): New. (__copy_move_a<>(_II, _II, const _Safe_iterator<>&)): New. (copy, move): Adapt, call __copy_move_a. (__copy_move_backward_a1<>(_II, _II, _OI)): New, call __copy_move_backward_a2. (__copy_move_backward_a1<>(_Deque_iterator<>, _Deque_iterator<>, _OI)): New. (__copy_move_backward_a1<>(_Deque_iterator<>, _Deque_iterator<>, _Deque_iterator<>)): New. (__copy_move_backward_a1<>(_II, _II, _Deque_iterator<>)): New. (__copy_move_backward_a<>(_II, _II, _OI)): Adapt, call __copy_move_backward_a1<>. (__copy_move_backward_a<>(const _Safe_iterator<>&, const _Safe_iterator<>&, _OI)): New. (__copy_move_backward_a<>(const _Safe_iterator<>&, const _Safe_iterator<>&, const _Safe_iterator<>&)): New. (__copy_move_backward_a<>(_II, _II, const _Safe_iterator<>&)): New. (copy_backward, move_backward): Adapt, call __copy_move_backward_a<>. (__fill_a): Rename into... (__fill_a1): ... this. (__fill_a1(__normal_iterator<>, __normal_iterator<>, const _Tp&)): New. (__fill_a1(const _Deque_iterator<>&, const _Deque_iterator<>&, _VTp)): New. (__fill_a(_FIte, _FIte, const _Tp&)): New, call __fill_a1. (__fill_a(const _Safe_iterator<>&, const _Safe_iterator<>&, const _Tp&)): New. (fill): Adapt, remove __niter_base usage. (__fill_n_a): Rename into... (__fill_n_a1): ...this. (__fill_n_a(const _Safe_iterator<>&, _Size, const _Tp&, input_iterator_tag)): New. (__fill_n_a(_OI, _Size, const _Tp&, output_iterator_tag)): New, call __fill_n_a1. (__fill_n_a(_OI, _Size, const _Tp&, random_access_iterator_tag)): New, call __fill_a. (__equal_aux): Rename into... (__equal_aux1): ...this. (__equal_aux1(_Deque_iterator<>, _Deque_iterator<>, _OI)): New. (__equal_aux1(_Deque_iterator<>, _Deque_iterator<>, _Deque_iterator<>)): New. (__equal_aux1(_II, _II, _Deque_iterator<>)): New. (__equal_aux(_II1, _II1, _II2)): New, call __equal_aux1. (__equal_aux(const _Safe_iterator<>&, const _Safe_iterator<>&, _OI)): New. (__equal_aux(const _Safe_iterator<>&, const _Safe_iterator<>&, const _Safe_iterator<>&)): New. (__equal_aux(_II, _II, const _Safe_iterator<>&)): New. (equal(_II1, _II1, _II2)): Adapt. * include/bits/stl_deque.h (fill, copy, copy_backward, move, move_backward): Remove. * include/bits/deque.tcc: Include <bits/stl_algobase.h>. (__fill_a1): New. (__copy_move_dit): New. (__copy_move_a1): New, use latter. (__copy_move_a1(_II, _II, _Deque_iterator<>)): New. (__copy_move_backward_dit): New. (__copy_move_backward_a1): New, use latter. (__copy_move_backward_a1(_II, _II, _Deque_iterator<>)): New. (__equal_dit): New. (__equal_aux1): New, use latter. (__equal_aux1(_II, _II, _Deque_iterator<>)): New. * include/std/numeric (__is_random_access_iter): Move... * include/bits/stl_iterator_base_types.h (__is_random_access_iter): ... here. Provide pre-C++11 definition. * include/debug/debug.h (_Safe_iterator<>): New declaration. * include/debug/safe_iterator.h (_Safe_iterator<>::_M_can_advance): Add __strict parameter. * include/debug/safe_iterator.tcc: Include <bits/stl_algobase.h>. (_Safe_iterator<>::_M_can_advance): Adapt. (std::__copy_move_a, std::__copy_move_backward_a, __fill_a): New. (__fill_n_a, __equal_aux): New. * include/debug/stl_iterator.h (__niter_base): Remove. * include/debug/vector (__niter_base): Remove. * testsuite/performance/25_algorithms/copy_backward_deque_iterators.cc: Include <vector> and <list>. Add benches. * testsuite/performance/25_algorithms/copy_deque_iterators.cc: Likewise. * testsuite/performance/25_algorithms/equal_deque_iterators.cc: Likewise. * testsuite/25_algorithms/copy/debug/1_neg.cc: New. * testsuite/25_algorithms/copy/deque_iterators/2.cc: New. * testsuite/25_algorithms/copy/deque_iterators/31.cc: New. * testsuite/25_algorithms/copy/deque_iterators/32.cc: New. * testsuite/25_algorithms/copy/deque_iterators/33.cc: New. * testsuite/25_algorithms/copy/deque_iterators/41.cc: New. * testsuite/25_algorithms/copy/deque_iterators/42.cc: New. * testsuite/25_algorithms/copy/deque_iterators/43.cc: New. * testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc (test02): New. * testsuite/25_algorithms/copy_backward/deque_iterators/2.cc: New. * testsuite/25_algorithms/equal/deque_iterators/1.cc: New. * testsuite/25_algorithms/fill/deque_iterators/1.cc: New. * testsuite/25_algorithms/move/deque_iterators/2.cc: New. * testsuite/25_algorithms/move_backward/deque_iterators/2.cc: New. From-SVN: r279201
2019-12-10libstdc++: Fix description of std::ios::trunc (PR 92886)Jonathan Wakely
PR libstdc++/92886 * include/bits/ios_base.h (std::ios_base::trunc): Fix comment. From-SVN: r279175
2019-12-10libstdc++: Define __cpp_lib_constexpr_complex macroJonathan Wakely
This is LWG issue 3349. * include/std/complex (__cpp_lib_constexpr_complex): Define. * include/std/version (__cpp_lib_constexpr_complex): Likewise. * testsuite/26_numerics/complex/1.cc: New test. * testsuite/26_numerics/complex/2.cc: New test. From-SVN: r279172
2019-12-10libstdc++: Reduce header dependencies in <span>Jonathan Wakely
* include/std/span: Do not include <tuple> and <utility>. (tuple_size, tuple_element): Declare. From-SVN: r279171
2019-12-10libstdc++: Fix bug in std::indirect_result_tJonathan Wakely
The alias template wasn't working because it applied iter_reference_t to the pack of iterators before and after passing the pack to the __indeirect_result helper. * include/bits/iterator_concepts.h (indirect_result_t): Do not apply iter_reference_t to parameter pack. * testsuite/24_iterators/indirect_callable/projected.cc: New test. From-SVN: r279170
2019-12-09libstdc++: Implement ranges::safe_range for C++20 (P1870R1)Jonathan Wakely
This change replaces the __forwarding_range implementation detail with the ranges::safe_range concept and adds the ranges::enable_safe_range variable template for opt-in in to the concept. It also adjusts the begin/end/rbegin/rend customization point objects to match the new rules for accessing rvalue ranges only when safe to do so. * include/bits/range_access.h (ranges::enable_safe_range): Define. (ranges::begin, ranges::end, ranges::rbegin, ranges::rend): Constrain to only accept types satisfying safe_range and treat argument as an lvalue when calling a member of performing ADL. (ranges::__detail::__range_impl, ranges::__detail::__forwarding_range): Remove. (ranges::range): Adjust definition. (ranges::safe_range): Define. (ranges::iterator_t, ranges::range_difference_t): Reorder definitions to match the synopsis in the working draft. (ranges::disable_sized_range): Remove duplicate definition. * include/experimental/string_view (ranges::enable_safe_range): Add partial specialization for std::experimental::basic_string_view. * include/std/ranges (ranges::viewable_range, ranges::subrange) (ranges::empty_view, ranges::iota_view): Use safe_range. Specialize enable_safe_range. (ranges::safe_iterator_t, ranges::safe_subrange_t): Define. * include/std/span (ranges::enable_safe_range): Add partial specialization for std::span. * include/std/string_view (ranges::enable_safe_range): Likewise for std::basic_string_view. * testsuite/std/ranges/access/begin.cc: Adjust expected results. * testsuite/std/ranges/access/cbegin.cc: Likewise. * testsuite/std/ranges/access/cdata.cc: Likewise. * testsuite/std/ranges/access/cend.cc: Likewise. * testsuite/std/ranges/access/crbegin.cc: Likewise. * testsuite/std/ranges/access/crend.cc: Likewise. * testsuite/std/ranges/access/data.cc: Likewise. * testsuite/std/ranges/access/end.cc: Likewise. * testsuite/std/ranges/access/rbegin.cc: Likewise. * testsuite/std/ranges/access/rend.cc: Likewise. * testsuite/std/ranges/empty_view.cc: Test ranges::begin and ranges::end instead of unqualified calls to begin and end. * testsuite/std/ranges/safe_range.cc: New test. * testsuite/std/ranges/safe_range_types.cc: New test. * testsuite/util/testsuite_iterators.h: Add comment about safe_range. From-SVN: r279135
2019-12-09libstdc++: Improve testing for path::operator+=(const string&)Jonathan Wakely
* testsuite/27_io/filesystem/path/concat/strings.cc: Test more cases. From-SVN: r279111
2019-12-09libstdc++: fix buffer overflow in path::operator+= (PR92853)Jonathan Wakely
When concatenating a path ending in a root-directory onto another path, we added an empty filename to the end of the path twice, but only reserved space for one. That meant the second write went past the end of the allocated buffer. PR libstdc++/92853 * src/c++17/fs_path.cc (filesystem::path::operator+=(const path&)): Do not process a trailing directory separator twice. * testsuite/27_io/filesystem/path/concat/92853.cc: New test. * testsuite/27_io/filesystem/path/concat/path.cc: Test more cases. From-SVN: r279110
2019-12-09libstdc++: Add C++20 P1032 constexpr to _GLIBCXX_DEBUG arrayFrançois Dumont
* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Fix static_assert line number. * testsuite/23_containers/array/tuple_interface/ tuple_element_debug_neg.cc: Likewise. From-SVN: r279108
2019-12-07Fix libstdc++ compiling for an aarch64 multilib with big-endian.Andrew Pinski
2019-12-07 Andrew Pinski <apinski@marvell.com> * config/cpu/aarch64/opt/ext/opt_random.h: Wrap around with check for little-endian like ext/random is done. From-SVN: r279081
2019-12-05libstdc++: Fix bug in std::span testJonathan Wakely
The previous commit fixed the std::span constructors from const arrays, revealing a bug in this test. * testsuite/23_containers/span/lwg3255.cc: Fix test. Constructing a span of non-const elements should not be possible from a const array or an array of const elements. From-SVN: r279001
2019-12-05libstdc++: Implement P1872R0 and P1394R0 for std::spanJeanHeyd "ThePhD" Meneide
This also fixes a bug in the implementation of LWG 3255, which causes: FAIL: 23_containers/span/lwg3255.cc (test for excess errors) That's because the test was wrong and verified the buggy behaviour. That will be fixed in the following commit. 2019-12-05 JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com> Implement P1872R0 and P1394R0 for std::span * include/bits/range_access.h (__adl_begin, __adl_end): Remove. (sentinel_t, range_value_t, range_reference_t) (range_rvalue_reference_t, __forwarding_range, disable_sized_range) (output_range, input_range, forward_range, bidirectional_range) (random_access_range, contiguous_range, common_range): Move here from <ranges>, to make this the "ranges lite" internal header. * include/std/ranges: Move basic aliases and concepts to <bits/range_access.h>. * include/std/span: Use concepts and ranges:: calls instead of enable_if and friends. * include/std/type_traits: Add __is_array_convertible trait. From-SVN: r279000
2019-12-05libstdc++: Define std::lexicographical_compare_three_way for C++20Jonathan Wakely
* include/bits/stl_algobase.h (lexicographical_compare_three_way): Define for C++20. * testsuite/25_algorithms/lexicographical_compare_three_way/1.cc: New test. * testsuite/25_algorithms/lexicographical_compare_three_way/ constexpr.cc: New test. From-SVN: r278996
2019-12-05libstdc++: Define pretty printer for comparison categoriesJonathan Wakely
* python/libstdcxx/v6/printers.py (StdCmpCatPrinter): New printer. * testsuite/libstdc++-prettyprinters/cxx20.cc: New test. From-SVN: r278982
2019-12-05libstdc++: Implement spaceship for std::array (P1614R2)Jonathan Wakely
As done for std::pair, this defines operator<=> as a non-member function template and does not alter operator==, as expected to be proposed as the resolution to an unpublished LWG issue. Instead of calling std::lexicographical_compare_three_way the <=> overload is implemented by hand to take advantage of the fact the element types and array sizes are known to be the same. * include/bits/cpp_type_traits.h (__is_byte<char8_t>): Add specialization. * include/std/array (operator<=>): Likewise. * testsuite/23_containers/array/comparison_operators/constexpr.cc: Test three-way comparisons and arrays of unsigned char. * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust dg-error line numbers. From-SVN: r278981
2019-12-03libstdc++: Implement spaceship for std::pair (P1614R2)Jonathan Wakely
This defines operator<=> as a non-member function template and does not alter operator==. This contradicts the changes made by P1614R2, which specify both as hidden friends, but that specification of operator<=> is broken and the subject of a soon-to-be-published LWG issue. * include/bits/stl_pair.h [__cpp_lib_three_way_comparison] (operator<=>): Define for C++20. * libsupc++/compare (__cmp2way_res_t): Rename to __cmp3way_res_t, move into __detail namespace. Do not turn argument types into lvalues. (__cmp3way_helper): Rename to __cmp3way_res_impl, move into __detail namespace. Constrain with concepts instead of using void_t. (compare_three_way_result): Adjust name of base class. (compare_three_way_result_t): Use __cmp3way_res_impl directly. (__detail::__3way_cmp_with): Add workaround for PR 91073. (compare_three_way): Use workaround. (__detail::__synth3way, __detail::__synth3way_t): Define new helpers implementing synth-three-way and synth-three-way-result semantics. * testsuite/20_util/pair/comparison_operators/constexpr_c++20.cc: New test. From-SVN: r278951
2019-12-03libstdc++: Fix Doxygen markup errorJonathan Wakely
* include/bits/stl_pair.h (pair): Remove stray Doxygen closing marker. From-SVN: r278950