- 18 Jun, 2019 1 commit
-
-
* include/c_global/cstddef (std::byte): Perform arithmetic operations in unsigned int to avoid promotion (LWG 2950). From-SVN: r272415
Jonathan Wakely committed
-
- 17 Jun, 2019 5 commits
-
-
On AIX the sized delete defined in the library will call the non-sized delete defined in the library, not the replacement version defined in the test file. By also replacing sized delete we make the test pass everywhere. * testsuite/20_util/allocator/1.cc: Add sized delete, which fixes a failure on AIX. From-SVN: r272391
Jonathan Wakely committed -
* include/c_global/cmath (__lerp, lerp): Add noexcept (LWG 3201). From-SVN: r272386
Jonathan Wakely committed -
Fix several bugs in the encoding conversions for filesystem::path that prevent conversion of Unicode characters outside the Basic Multilingual Plane, and prevent returning basic_string specializations with alternative allocator types. The std::codecvt_utf8 class template is not suitable for UTF-16 conversions because it uses UCS-2 instead. For conversions between UTF-8 and UTF-16 either std::codecvt<C, char, mbstate> or codecvt_utf8_utf16<C> must be used. The __str_codecvt_in and __str_codecvt_out utilities do not return false on a partial conversion (e.g. for invalid or incomplete Unicode input). Add new helpers that treat partial conversions as errors, and use them for all filesystem::path conversions. PR libstdc++/90281 Fix string conversions for filesystem::path * include/bits/fs_path.h (u8path) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use codecvt_utf8_utf16 instead of codecvt_utf8. Use __str_codecvt_in_all to fail for partial conversions and throw on error. [!_GLIBCXX_FILESYSTEM_IS_WINDOWS && _GLIBCXX_USE_CHAR8_T] (path::_Cvt<char8_t>): Add explicit specialization. [_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_wconvert): Remove overloads. [_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_convert): Use if-constexpr instead of dispatching to _S_wconvert. Use codecvt instead of codecvt_utf8. Use __str_codecvt_in_all and __str_codecvt_out_all. [!_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_convert): Use codecvt instead of codecvt_utf8. Use __str_codecvt_out_all. (path::_S_str_convert) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use codecvt_utf8_utf16 instead of codecvt_utf8. Construct return values with allocator. Use __str_codecvt_out_all. Fallthrough to POSIX code after converting to UTF-8. (path::_S_str_convert): Use codecvt instead of codecvt_utf8. Use __str_codecvt_in_all. (path::string): Fix initialization of string types with different allocators. (path::u8string) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use codecvt_utf8_utf16 instead of codecvt_utf8. Use __str_codecvt_out_all. * include/bits/locale_conv.h (__do_str_codecvt): Reorder static and runtime conditions. (__str_codecvt_out_all, __str_codecvt_in_all): New functions that return false for partial conversions. * include/experimental/bits/fs_path.h (u8path): [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Implement correctly for mingw. [_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_wconvert): Add missing handling for char8_t. Use codecvt and codecvt_utf8_utf16 instead of codecvt_utf8. Use __str_codecvt_in_all and __str_codecvt_out_all. [!_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_convert): Use codecvt instead of codecvt_utf8. Use __str_codecvt_out_all. (path::string) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use codecvt_utf8_utf16 instead of codecvt_utf8. Construct return values with allocator. Use __str_codecvt_out_all and __str_codecvt_in_all. (path::string) [!_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use __str_codecvt_in_all. (path::u8string) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use codecvt_utf8_utf16 instead of codecvt_utf8. Use __str_codecvt_out_all. * src/c++17/fs_path.cc (path::_S_convert_loc): Use __str_codecvt_in_all. * src/filesystem/path.cc (path::_S_convert_loc): Likewise. * testsuite/27_io/filesystem/path/construct/90281.cc: New test. * testsuite/27_io/filesystem/path/factory/u8path.cc: New test. * testsuite/27_io/filesystem/path/native/string.cc: Test with empty strings and with Unicode characters outside the basic multilingual plane. * testsuite/27_io/filesystem/path/native/alloc.cc: New test. * testsuite/experimental/filesystem/path/construct/90281.cc: New test. * testsuite/experimental/filesystem/path/factory/u8path.cc: New test. * testsuite/experimental/filesystem/path/native/alloc.cc: New test. * testsuite/experimental/filesystem/path/native/string.cc: Test with empty strings and with Unicode characters outside the basic multilingual plane. From-SVN: r272385
Jonathan Wakely committed -
Introduce an RAII type to manage nodes in unordered containers while they are being inserted. If the caller always owns a node until it is inserted, then the insertion functions don't need to deallocate on failure. This allows a FIXME in the node re-insertion API to be removed. Also change extract(const key_type&) to not call extract(const_iterator) anymore. This avoids looping through the bucket nodes again to find the node before the one being extracted. 2019-06-17 François Dumont <fdumont@gcc.gnu.org> Jonathan Wakely <jwakely@redhat.com> * include/bits/hashtable.h (struct _Hashtable::_Scoped_node): New type. (_Hashtable::_M_insert_unique_node): Add key_type parameter. Don't deallocate node if insertion fails. (_Hashtable::_M_insert_multi_node): Likewise. (_Hashtable::_M_reinsert_node): Pass additional key argument. (_Hashtable::_M_reinsert_node_multi): Likewise. Remove FIXME. (_Hashtable::_M_extract_node(size_t, __node_base*)): New function. (_Hashtable::extract(const_iterator)): Use _M_extract_node. (_Hashtable::extract(const _Key&)): Likewise. (_Hashtable::_M_merge_unique): Pass additional key argument. (_Hashtable::_M_emplace<Args>(true_type, Args&&...)): Likewise. Use _Scoped_node. (_Hashtable::_M_insert): Likewise. * include/bits/hashtable_policy.h (_Map_base::operator[]): Likewise. (_Hashtable_alloc): Add comments to functions with misleading names. Co-Authored-By: Jonathan Wakely <jwakely@redhat.com> From-SVN: r272381
François Dumont committed -
The recent change to stop transitively including <string> broke some tests, but only when the library is configured without PCH, because otherwise the <string> header still gets included via the precompiled <bits/stdc++.h> header. * testsuite/20_util/bad_function_call/what.cc: Include <string> header for std::string. * testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc: Likewise. * testsuite/20_util/tuple/cons/allocator_with_any.cc: Include <memory> header for std::allocator. * testsuite/23_containers/array/tuple_interface/tuple_element.cc: Add using-declaration for std::size_t. * testsuite/23_containers/array/tuple_interface/tuple_size.cc: Likewise. * testsuite/23_containers/deque/cons/55977.cc: Include <istream> for std::istream. * testsuite/23_containers/vector/cons/55977.cc: Likewise. * testsuite/experimental/map/erasure.cc: Include <string> for std::string. * testsuite/experimental/unordered_map/erasure.cc: Likewise. From-SVN: r272376
Jonathan Wakely committed
-
- 14 Jun, 2019 2 commits
-
-
* include/experimental/type_traits (experimental::nonesuch): Use pragma to disable -Wctor-dtor-privacy warnings. * include/std/type_traits (__is_convertible_helper<From, To, false>) (__is_nt_convertible_helper<From, To, false>, __nonesuch): Likewise. From-SVN: r272289
Jonathan Wakely committed -
* include/std/version (__cpp_lib_bind_front): Add missing macro. From-SVN: r272288
Jonathan Wakely committed
-
- 12 Jun, 2019 4 commits
-
-
* include/std/algorithm (__cpp_lib_parallel_algorithm): Fix value. * include/std/memory (__cpp_lib_parallel_algorithm): Likewise. * include/std/numeric (__cpp_lib_parallel_algorithm): Likewise. * testsuite/25_algorithms/pstl/feature_test.cc: New test. From-SVN: r272216
Jonathan Wakely committed -
Also fix a warning with -Wunused-parameter -Wsystem-headers. * include/std/variant (get<T>, get<N>, get_if<N>, get_if<T>) (variant::emplace): Change static_assert messages from "should be" to "must be". (hash<monostate>::operator()): Remove name of unused parameter. From-SVN: r272188
Jonathan Wakely committed -
* include/std/mutex (scoped_lock::~scoped_lock()): Use fold expression. From-SVN: r272187
Jonathan Wakely committed -
The std::to_chars functions from C++17 can be used to implement std::to_string with much better performance than calling snprintf. Only the __detail::__to_chars_len and __detail::__to_chars_10 functions are needed for to_string, because it always outputs base 10 representations. The return type of __detail::__to_chars_10 should not be declared before C++17, so the function body is extracted into a new function that can be reused by to_string and __detail::__to_chars_10. The existing tests for to_chars rely on to_string to check for correct answers. Now that they use the same code that doesn't actually ensure correctness, so add new tests for std::to_string that compare against printf output. * include/Makefile.am: Add new <bits/charconv.h> header. * include/Makefile.in: Regenerate. * include/bits/basic_string.h (to_string(int), to_string(unsigned)) (to_string(long), to_string(unsigned long), to_string(long long)) (to_string(unsigned long long)): Rewrite to use __to_chars_10_impl. * include/bits/charconv.h: New header. (__detail::__to_chars_len): Move here from <charconv>. (__detail::__to_chars_10_impl): New function extracted from __detail::__to_chars_10. * include/std/charconv (__cpp_lib_to_chars): Add, but comment out. (__to_chars_unsigned_type): New class template that reuses __make_unsigned_selector_base::__select to pick a type. (__unsigned_least_t): Redefine as __to_chars_unsigned_type<T>::type. (__detail::__to_chars_len): Move to new header. (__detail::__to_chars_10): Add inline specifier. Move code doing the output to __detail::__to_chars_10_impl and call that. * include/std/version (__cpp_lib_to_chars): Add, but comment out. * testsuite/21_strings/basic_string/numeric_conversions/char/ to_string.cc: Fix reference in comment. Remove unused variable. * testsuite/21_strings/basic_string/numeric_conversions/char/ to_string_int.cc: New test. From-SVN: r272186
Jonathan Wakely committed
-
- 11 Jun, 2019 1 commit
-
-
2019-06-09 Edward Smith-Rowland <3dw4rd@verizon.net> Fix ConstexprIterator requirements tests - No constexpr algorithms! * testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc: Replace copy with hand-rolled loop. * testsuite/23_containers/array/requirements/constexpr_iter.cc: Ditto. From-SVN: r272159
Edward Smith-Rowland committed
-
- 08 Jun, 2019 1 commit
-
-
2019-06-08 Edward Smith-Rowland <3dw4rd@verizon.net> Test for C++20 p0858 - ConstexprIterator requirements. * testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc: New test. * testsuite/23_containers/array/requirements/constexpr_iter.cc: New test. From-SVN: r272085
Edward Smith-Rowland committed
-
- 07 Jun, 2019 3 commits
-
-
Rename PSTL macro's consistent with libstdc++ (and llvm upstream project) standards. * include/bits/c++config: Rename all macros of the form __PSTL* to _PSTL*. * include/std/algorithm: Likewise. * include/std/execution: Likewise. * include/std/numeric: Likewise. * include/std/memory: Likewise. * include/pstl/glue_memory_impl.h: Likewise. * include/pstl/numeric_impl.h: Likewise. * include/pstl/glue_memory_defs.h: Likewise. * include/pstl/execution_defs.h: Likewise. * include/pstl/utils.h: Likewise. * include/pstl/algorithm_fwd.h: Likewise. * include/pstl/unseq_backend_simd.h: Likewise. * include/pstl/glue_execution_defs.h: Likewise. * include/pstl/algorithm_impl.h: Likewise. * include/pstl/parallel_impl.h: Likewise. * include/pstl/memory_impl.h: Likewise. * include/pstl/glue_numeric_defs.h: Likewise. * include/pstl/parallel_backend_utils.h: Likewise. * include/pstl/glue_algorithm_defs.h: Likewise. * include/pstl/parallel_backend.h: Likewise. * include/pstl/glue_numeric_impl.h: Likewise. * include/pstl/parallel_backend_tbb.h: Likewise. * include/pstl/numeric_fwd.h: Likewise. * include/pstl/glue_algorithm_impl.h: Likewise. * include/pstl/execution_impl.h: Likewise. * include/pstl/pstl_config.h: Likewise. * testsuite/util/pstl/pstl_test_config.h: Likewise. * testsuite/util/pstl/test_utils.h: Likewise. * testsuite/20_util/specialized_algorithms/pstl/uninitialized_construct.cc: Likewise. * testsuite/20_util/specialized_algorithms/pstl/uninitialized_copy_move.cc: Likewise. * testsuite/26_numerics/pstl/numeric_ops/adjacent_difference.cc: Likewise. * testsuite/26_numerics/pstl/numeric_ops/scan.cc: Likewise. * testsuite/26_numerics/pstl/numeric_ops/transform_scan.cc: Likewise. * testsuite/26_numerics/pstl/numeric_ops/reduce.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/reverse.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/find_end.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/find_if.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/none_of.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/count.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/reverse_copy.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/equal.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/search_n.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/find.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/all_of.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/find_first_of.cc: Likewise. * testsuite/25_algorithms/pstl/alg_sorting/is_heap.cc: Likewise. * testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc: Likewise. * testsuite/25_algorithms/pstl/alg_sorting/partial_sort_copy.cc: Likewise. * testsuite/25_algorithms/pstl/alg_sorting/lexicographical_compare.cc: Likewise. * testsuite/25_algorithms/pstl/alg_merge/inplace_merge.cc: Likewise. * testsuite/25_algorithms/pstl/alg_merge/merge.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/unique_copy_equal.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/replace_copy.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/is_partitioned.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/rotate_copy.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/remove.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/copy_if.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/partition_copy.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/partition.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/copy_move.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/unique.cc: Likewise. * testsuite/25_algorithms/pstl/alg_modifying_operations/rotate.cc: Likewise. * testsuite/25_algorithms/pstl/alg_nonmodifying/any_of.cc: Likewise. Rename header guards to be consistent with upstream project's conventions. * include/pstl/glue_memory_impl.h: Rename all macros of the form _PSTL_(.*)_H to _PSTL_\U\1_H. * include/pstl/numeric_impl.h: Likewise. * include/pstl/glue_memory_defs.h: Likewise. * include/pstl/execution_defs.h: Likewise. * include/pstl/utils.h: Likewise. * include/pstl/algorithm_fwd.h: Likewise. * include/pstl/unseq_backend_simd.h: Likewise. * include/pstl/glue_execution_defs.h: Likewise. * include/pstl/algorithm_impl.h: Likewise. * include/pstl/parallel_impl.h: Likewise. * include/pstl/memory_impl.h: Likewise. * include/pstl/glue_numeric_defs.h: Likewise. * include/pstl/parallel_backend_utils.h: Likewise. * include/pstl/glue_algorithm_defs.h: Likewise. * include/pstl/parallel_backend.h: Likewise. * include/pstl/glue_numeric_impl.h: Likewise. * include/pstl/parallel_backend_tbb.h: Likewise. * include/pstl/numeric_fwd.h: Likewise. * include/pstl/glue_algorithm_impl.h: Likewise. * include/pstl/execution_impl.h: Likewise. * include/pstl/pstl_config.h: Likewise. * testsuite/util/pstl/pstl_test_config.h: Likewise. Synchronize libstdc++ parallel algorithms with upstream project. * include/pstl/algorithm_fwd.h: Synchronize with upstream PSTL project. * include/pstl/algorithm_impl.h: Likewise. * include/pstl/execution_defs.h: Likewise. * include/pstl/execution_impl.h: Likewise. * include/pstl/glue_algorithm_impl.h: Likewise. * include/pstl/glue_execution_defs.h: Likewise. * include/pstl/numeric_fwd.h: Likewise. * include/pstl/numeric_impl.h: Likewise. * include/pstl/parallel_backend.h: Likewise. * include/pstl/pstl_config.h: Likewise. * include/pstl/unseq_backend_simd.h: Likewise. * include/pstl/parallel_backend_serial.h: New file. * include/Makefile.am (pstl_headers): Add parallel_backend_serial.h. * include/Makefile.in: Regenerate. Clean up non-conforming names * include/pstl/algorithm_impl.h (__parallel_set_union_op): Uglfiy copy_range1 and copy_range2 (__pattern_walk2_n): Rename local n to __n * include/pstl/parallel_backend_tbb.h (struct __binary_no_op): Rename parameter _T to _Tp. Integrate non-TBB serial backend support * include/bits/c++config: Adjust TBB detection logic to select serial PSTL backend if no TBB present. * testsuite/utils/pstl/test_utils.h: Remove check for _PSTL_USE_PAR_POLICIES From-SVN: r272056
Thomas Rodgers committed -
* testsuite/24_iterators/container_access.cc: Move dg-options before dg-do directive so the target check uses the -std option. From-SVN: r272051
Jonathan Wakely committed -
PR libstdc++/90770 * configure: Regenerate. * src/Makefile.am (stamp-debug): Also test for missing makefile. * src/Makefile.in: Regenerate. From-SVN: r272050
Jonathan Wakely committed
-
- 06 Jun, 2019 7 commits
-
-
This can greatly reduce the amount of preprocessed code that is included by other headers, because <stdexcept> depends on <string> which is huge. * include/std/array: Do not include <stdexcept>. * include/std/optional: Include <exception> and <bits/exception_defines.h> instead of <stdexcept>. * testsuite/20_util/function_objects/searchers.cc: Include <cctype> for std::isalnum. * testsuite/20_util/tuple/cons/deduction.cc: Include <memory> for std::allocator. * testsuite/23_containers/map/erasure.cc: Include <string>. * testsuite/23_containers/unordered_map/erasure.cc: Likewise. From-SVN: r272011
Jonathan Wakely committed -
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Add dg-prune-output for different C++98 diagnostic. * testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. * testsuite/libstdc++-prettyprinters/compat.cc: Do not run for C++98. From-SVN: r272010
Jonathan Wakely committed -
* testsuite/23_containers/unordered_map/requirements/debug_container.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: Change dg-do directive for C++17 and C++2a. From-SVN: r272009
Jonathan Wakely committed -
The GNU extension that allows using the wrong allocator type with a container is disabled for C++2a mode, because the standard now requires a diagnostic. Fix the tests that fail when -std=gnu++2a is used. Also remove some reundant tests that are duplicates of another test except for a target specifier of c++11. Those tests previously set -std=gnu++11 explicitly but that was replaced globally with a target specifier. These tests existed to verify that explicit instantiation worked for both C++98 and C++11 modes, but now do nothing because both copies of the test use -std=gnu++14 by default. Instead of duplicating the test we should be regularly running the whole testsuite with different -std options. * testsuite/23_containers/deque/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/deque/requirements/explicit_instantiation/ 2.cc: Use target selector instead of preprocessor condition. * testsuite/23_containers/deque/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/forward_list/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/forward_list/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/list/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/list/requirements/explicit_instantiation/ 2.cc: Use target selector instead of preprocessor condition. * testsuite/23_containers/list/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/list/requirements/explicit_instantiation/ 5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/map/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/map/requirements/explicit_instantiation/ 2.cc: Adjust comment. * testsuite/23_containers/map/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/map/requirements/explicit_instantiation/ 5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/set/requirements/explicit_instantiation/3.cc: Do not run test for C++2a. * testsuite/23_containers/set/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/set/requirements/explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/3.cc: Do not run test for C++2a. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/3.cc: Do not run test for C++2a. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/3.cc: Do not run test for C++2a. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/vector/ext_pointer/explicit_instantiation/ 2.cc: Remove redundant test. * testsuite/23_containers/vector/ext_pointer/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/vector/requirements/explicit_instantiation/ 3.cc: Likewise. From-SVN: r272001
Jonathan Wakely committed -
The type property predicates that are implemented by a compiler builtin already do the right checks in the compiler. The checks for complete type or unbounded arrays were wrong for these types anyway. * include/std/type_traits (is_empty, is_polymorphic, is_final) (is_abstract, is_aggregate): Remove static_assert. * testsuite/20_util/is_abstract/incomplete_neg.cc: Check for error from builtin only. * testsuite/20_util/is_aggregate/incomplete_neg.cc: Likewise. Add missing -std=gnu++17 option. * testsuite/20_util/is_empty/incomplete_neg.cc: New test. * testsuite/20_util/is_final/incomplete_neg.cc: New test. * testsuite/20_util/is_polymorphic/incomplete_neg.cc: Check for error from builtin only. From-SVN: r272000
Jonathan Wakely committed -
* testsuite/18_support/set_terminate.cc: Do not run for C++98 mode. * testsuite/18_support/set_unexpected.cc: Likewise. * testsuite/20_util/is_nothrow_invocable/value.cc: Test converting to void. * testsuite/20_util/is_nothrow_invocable/value_ext.cc: Fix constexpr function to be valid in C++11. * testsuite/26_numerics/complex/proj.cc: Do not run for C++98 mode. * testsuite/experimental/names.cc: Do not run for C++98 mode. Do not include Library Fundamentals or Networking headers in C++11 mode. * testsuite/ext/char8_t/atomic-1.cc: Do not run for C++98 mode. From-SVN: r271999
Jonathan Wakely committed -
Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple<T1, T2> partial specialization the _TupleConstraints members are used via new alias templates like _ImplicitCtor and _ExplicitCtor which makes the constructor constraints less verbose and repetitive. For example, where we previously had: template<typename... _UElements, typename enable_if< _TMC<_UElements...>::template _MoveConstructibleTuple<_UElements...>() && _TMC<_UElements...>::template _ImplicitlyMoveConvertibleTuple<_UElements...>() && (sizeof...(_Elements) >= 1), bool>::type=true> constexpr tuple(_UElements&&... __elements) We now have: template<typename... _UElements, bool _Valid = __valid_args<_UElements...>(), _ImplicitCtor<_Valid, _UElements...> = true> constexpr tuple(_UElements&&... __elements) There are two semantic changes as a result of the refactoring: - The allocator-extended default constructor is now constrained. - The rewritten constraints fix PR 90700. * include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple<T1, T2>::_TCC, tuple<T1, T2>::_ImplicitDefaultCtor) (tuple<T1, T2>::_ExplicitDefaultCtor, tuple<T1, T2>::_ImplicitCtor) (tuple<T1, T2>::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__is_alloc_arg()): New SFINAE helpers. (tuple<T1, T2>::tuple): Use new helpers to reduce repitition in constraints. (tuple<T1, T2>::tuple(allocator_arg_t, const Alloc&)): Constrain. * testsuite/20_util/tuple/cons/90700.cc: New test. * testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor. From-SVN: r271998
Jonathan Wakely committed
-
- 03 Jun, 2019 5 commits
-
-
* include/bits/stl_map.h (map): Disable static assert for C++98 mode. * include/bits/stl_multimap.h (multimap): Likewise. From-SVN: r271884
Jonathan Wakely committed -
2019-06-03 François Dumont <fdumont@gcc.gnu.org> Rename variables and cleanup comments. * include/bits/hashtable_policy.h * include/bits/hashtable.h From-SVN: r271876
François Dumont committed -
* doc/xml/manual/status_cxx2020.xml: Add missing row for P0920R2. Fix bgcolor for P0340R3. * doc/html/*: Regenerate. From-SVN: r271868
Jonathan Wakely committed -
PR libstdc++/90686 * doc/xml/manual/status_cxx2014.xml: Document what's missing from <experimental/memory_resource>. * doc/xml/manual/status_cxx2020.xml: Document status of P1285R0, P0339R6, P0340R3, P1164R1 and P1357R1. * doc/html/*: Regenerate. From-SVN: r271867
Jonathan Wakely committed -
In previous standards it is undefined for a container and its allocator to have a different value_type. Libstdc++ has traditionally allowed it as an extension, automatically rebinding the allocator to the container's value_type. Since GCC 8.1 that extension has been disabled for C++11 and later when __STRICT_ANSI__ is defined (i.e. for -std=c++11, -std=c++14, -std=c++17 and -std=c++2a). Since the acceptance of P1463R1 into the C++2a draft an incorrect allocator::value_type now requires a diagnostic. This patch implements that by enabling the static_assert for -std=gnu++2a as well. * doc/xml/manual/status_cxx2020.xml: Document P1463R1 status. * include/bits/forward_list.h [__cplusplus > 201703]: Enable allocator::value_type assertion for C++2a. * include/bits/hashtable.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_vector.h: Likewise. * testsuite/23_containers/deque/48101-3_neg.cc: New test. * testsuite/23_containers/forward_list/48101-3_neg.cc: New test. * testsuite/23_containers/list/48101-3_neg.cc: New test. * testsuite/23_containers/map/48101-3_neg.cc: New test. * testsuite/23_containers/multimap/48101-3_neg.cc: New test. * testsuite/23_containers/multiset/48101-3_neg.cc: New test. * testsuite/23_containers/set/48101-3_neg.cc: New test. * testsuite/23_containers/unordered_map/48101-3_neg.cc: New test. * testsuite/23_containers/unordered_multimap/48101-3_neg.cc: New test. * testsuite/23_containers/unordered_multiset/48101-3_neg.cc: New test. * testsuite/23_containers/unordered_set/48101-3_neg.cc: New test. * testsuite/23_containers/vector/48101-3_neg.cc: New test. From-SVN: r271866
Jonathan Wakely committed
-
- 31 May, 2019 7 commits
-
-
From-SVN: r271827
Gerald Pfeifer committed -
* include/std/tuple (tuple<>): Add noexcept to allocator-extended constructors. (tuple<T1, T2>::__nothrow_default_constructible()): New helper function. (tuple<T1, T2>::tuple(), explicit tuple<T1, T2>::tuple()): Use helper. From-SVN: r271814
Jonathan Wakely committed -
Restore the using-declaration but locally in the source file, not in the header. * src/c++98/bitmap_allocator.cc: Add using-declaration for size_t. From-SVN: r271812
Jonathan Wakely committed -
Make these functions restore the default handlers when passed a null pointer. This is consistent with std::pmr::set_default_resource(0), and also matches the current behaviour of libc++. In order to avoid duplicating the preprocessor condition from eh_term_handler.cc more that into a new eh_term_handler.h header and define a macro that can be used in both eh_term_handler.cc and eh_terminate.cc. PR libstdc++/90682 * libsupc++/eh_term_handler.cc: Include eh_term_handler.h to get definition of _GLIBCXX_DEFAULT_TERM_HANDLER. * libsupc++/eh_term_handler.h: New header defining _GLIBCXX_DEFAULT_TERM_HANDLER. * libsupc++/eh_terminate.cc: Include eh_term_handler.h. (set_terminate): Restore default handler when argument is null. (set_unexpected): Likewise. * testsuite/18_support/set_terminate.cc: New test. * testsuite/18_support/set_unexpected.cc: New test. From-SVN: r271808
Jonathan Wakely committed -
These using-declarations appear to have been added for simplicity when moving the non-standard extensions from namespace std to namespace __gnu_cxx. Dumping all these names into namespace __gnu_cxx allows unportable uses like __gnu_cxx::size_t and __gnu_cxx::pair, which serve no useful purpose. This patch removes most of the using-declarations from namespace scope, then either qualifies names as needed or adds using-declarations at block scope or typedefs at class scope. * include/backward/hashtable.h (size_t, ptrdiff_t) (forward_iterator_tag, input_iterator_tag, _Construct, _Destroy) (distance, vector, pair, __iterator_category): Remove using-declarations that add these names to namespace __gnu_cxx. * include/ext/bitmap_allocator.h (size_t, ptrdiff_t): Likewise. * include/ext/debug_allocator.h (size_t): Likewise. * include/ext/functional (size_t, unary_function, binary_function) (mem_fun1_t, const_mem_fun1_t, mem_fun1_ref_t, const_mem_fun1_ref_t): Likewise. * include/ext/malloc_allocator.h (size_t, ptrdiff_t): Likewise. * include/ext/memory (ptrdiff_t, pair, __iterator_category): Likewise. * include/ext/mt_allocator.h (size_t, ptrdiff_t): Likewise. * include/ext/new_allocator.h (size_t, ptrdiff_t): Likewise. * include/ext/numeric (iota): Fix outdated comment. * include/ext/pool_allocator.h (size_t, ptrdiff_t): Likewise. * include/ext/rb_tree (_Rb_tree, allocator): Likewise. * include/ext/rope (size_t, ptrdiff_t, allocator, _Destroy): Likewise. * include/ext/ropeimpl.h (size_t, printf, basic_ostream) (__throw_length_error, _Destroy, std::__uninitialized_fill_n_a): Likewise. * include/ext/slist (size_t, ptrdiff_t, _Construct, _Destroy) (allocator, __true_type, __false_type): Likewise. From-SVN: r271807
Jonathan Wakely committed -
This patch adds static asserts for type traits misuse with incomplete classes and unions. This gives a nice readable error message instead of an UB and odr-violations. Some features of the patch: * each type trait has it's own static_assert inside. This gives better diagnostics than the approach with putting the assert into a helper structure and using it in each trait. * the result of completeness check is not memorized by the compiler. This gives no false positive after the first failed check. * some of the compiler builtins already implement the check. But not all of them! So the asserts are in all the type_traits that may benefit from the check. This also makes the behavior of libstdc++ more consistent across different (non GCC) compilers. * std::is_base_of does not have the assert as it works well in many cases with incomplete types 2019-05-31 Antony Polukhin <antoshkka@gmail.com> PR libstdc++/71579 * include/std/type_traits __type_identity, __is_complete_or_unbounded): New helpers for checking preconditions in traits. (is_trivial, is_trivially_copyable, is_standard_layout, is_pod) (is_literal_type, is_empty, is_polymorphic, is_final, is_abstract) (is_destructible, is_nothrow_destructible, is_constructible) (is_default_constructible, is_copy_constructible) (is_move_constructible, is_nothrow_default_constructible) (is_nothrow_constructible, is_nothrow_copy_constructible) (is_nothrow_move_constructible, is_copy_assignable, is_move_assignable) (is_nothrow_assignable, is_nothrow_copy_assignable) (is_nothrow_move_assignable, is_trivially_constructible) (is_trivially_copy_constructible, is_trivially_move_constructible) is_trivially_assignable, is_trivially_copy_assignable) (is_trivially_move_assignable, is_trivially_destructible) (alignment_of, is_swappable, is_nothrow_swappable, is_invocable) (is_invocable_r, is_nothrow_invocable) (has_unique_object_representations, is_aggregate): Add static_asserts to make sure that type traits are not misused with incomplete types. (__is_constructible_impl, __is_nothrow_default_constructible_impl) (__is_nothrow_constructible_impl, __is_nothrow_assignable_impl): New base characteristics without assertions that can be reused in other traits. * testsuite/20_util/is_complete_or_unbounded/memoization.cc: New test. * testsuite/20_util/is_complete_or_unbounded/memoization_neg.cc: New test. * testsuite/20_util/is_complete_or_unbounded/value.cc: New test. * testsuite/20_util/is_abstract/incomplete_neg.cc: New test. * testsuite/20_util/is_aggregate/incomplete_neg.cc: New test. * testsuite/20_util/is_class/value.cc: Check incomplete type. * testsuite/20_util/is_function/value.cc: Likewise. * testsuite/20_util/is_move_constructible/incomplete_neg.cc: New test. * testsuite/20_util/is_nothrow_move_assignable/incomplete_neg.cc: New test. * testsuite/20_util/is_polymorphic/incomplete_neg.cc: New test. * testsuite/20_util/is_reference/value.cc: Check incomplete types. * testsuite/20_util/is_unbounded_array/value.cc: Likewise. * testsuite/20_util/is_union/value.cc: Likewise. * testsuite/20_util/is_void/value.cc: Likewise. * testsuite/util/testsuite_tr1.h: Add incomplete union type. From-SVN: r271806
Antony Polukhin committed -
Instead of duplicating the initialization functions that take string, add a new member taking a raw pointer that can be used to convert the constructor token from the old string to the new. Also fix "mt19337" typos in a testcase. * include/bits/random.h (random_device::_M_init(const char*, size_t)): Add new private member function. * src/c++11/cow-string-inst.cc (random_device::_M_init(const string&)) (random_device::_M_init_pretr1(const string&)): Call new private member with string data. * src/c++11/random.cc (random_device::_M_init(const char*, size_t)): Define. * testsuite/26_numerics/random/random_device/cons/default-cow.cc: New test using COW strings. * testsuite/26_numerics/random/random_device/cons/default.cc: Generate a value from the device. * testsuite/26_numerics/random/random_device/cons/token.cc: Likewise. Fix typo in token string. From-SVN: r271805
Jonathan Wakely committed
-
- 30 May, 2019 4 commits
-
-
This only change the cxx11 basic_string, because COW strings don't correctly propagate allocators anyway. 2019-05-30 Nina Dinka Ranns <dinka.ranns@gmail.com> LWG2788 basic_string spurious use of a default constructible allocator * include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI] (basic_string::_M_replace_dispatch): Construct temporary string with the current allocator. * testsuite/21_strings/basic_string/allocator/char/lwg2788.cc: New. * testsuite/21_strings/basic_string/allocator/wchar_t/lwg2788.cc: New. From-SVN: r271789
Nina Dinka Ranns committed -
* doc/xml/manual/diagnostics.xml: Update list of headers that define exception classes. * doc/xml/manual/support.xml: Rewrite advice around NULL. Rewrite section about new/delete overloads. Improve section on verbose terminate handler. * doc/html/*: Regenerate. From-SVN: r271782
Jonathan Wakely committed -
The status of P1353R0 was "Partial" because we don't define the __cpp_lib_three_way_comparison macro, but that's because we don't support the feature. So the paper can be marked as done. * doc/xml/manual/status_cxx2020.xml: Add feature-test macro for P0811R3. Change status of P1353R0. * doc/html/*: Regenerate. From-SVN: r271774
Jonathan Wakely committed -
* doc/xml/manual/status_cxx2011.xml: Use <variablelist> for documentation of implementation-defined types for [thread.req.native]. * doc/xml/manual/status_cxx2017.xml: Update documentation of implementation-defined strings for [variant.bad.access]. Fix typo in documentation of implementation-defined support for [fs.conform.9945]. * doc/html/*: Regenerate. From-SVN: r271773
Jonathan Wakely committed
-