Commit Graph

4242 Commits

Author SHA1 Message Date
Jonathan Wakely b219eb0378 Adjust test to pass with latest glibc
Glibc changed the it_IT locales to use thousands separators,
invalidating this test. Use nl_NL instead, as Dutch only uses grouping
for money not numbers.

	* testsuite/22_locale/numpunct/members/char/3.cc: Adjust test to
	account for change to glibc it_IT localedata (glibc bz#10797).

From-SVN: r265165
2018-10-15 14:55:42 +01:00
Jonathan Wakely e5989e71ff Initial commit of Networking TS implementation
* include/Makefile.am: Add new headers.
	* include/Makefile.in: Regenerate.
	* include/experimental/bits/net.h: New header for common
	implementation details of Networking TS.
	* include/experimental/buffer: New header.
	* include/experimental/executor: New header.
	* include/experimental/internet: New header.
	* include/experimental/io_context: New header.
	* include/experimental/net: New header.
	* include/experimental/netfwd: New header.
	* include/experimental/socket: New header.
	* include/experimental/timer: New header.
	* testsuite/experimental/net/buffer/arithmetic.cc: New test.
	* testsuite/experimental/net/buffer/const.cc: New test.
	* testsuite/experimental/net/buffer/creation.cc: New test.
	* testsuite/experimental/net/buffer/mutable.cc: New test.
	* testsuite/experimental/net/buffer/size.cc: New test.
	* testsuite/experimental/net/buffer/traits.cc: New test.
	* testsuite/experimental/net/execution_context/use_service.cc: New
	test.
	* testsuite/experimental/net/headers.cc: New test.
	* testsuite/experimental/net/internet/address/v4/comparisons.cc: New
	test.
	* testsuite/experimental/net/internet/address/v4/cons.cc: New test.
	* testsuite/experimental/net/internet/address/v4/creation.cc: New
	test.
	* testsuite/experimental/net/internet/address/v4/members.cc: New
	test.
	* testsuite/experimental/net/internet/resolver/base.cc: New test.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc: New
	test.
	* testsuite/experimental/net/internet/resolver/ops/reverse.cc: New
	test.
	* testsuite/experimental/net/timer/waitable/cons.cc: New test.
	* testsuite/experimental/net/timer/waitable/dest.cc: New test.
	* testsuite/experimental/net/timer/waitable/ops.cc: New test.

From-SVN: r265080
2018-10-12 11:50:15 +01:00
Jonathan Wakely 49cb790a4c PR libstdc++/77691 increase allocation size to at least alignment
It's not safe to assume that malloc(n) returns memory aligned to more
than n, so when relying on the guaranteed alignment of malloc ensure
that the number of bytes allocated is at least as large as the
alignment.

	PR libstdc++/77691
	* include/experimental/memory_resource (__resource_adaptor_imp): Do
	not allocate sizes smaller than alignment when relying on guaranteed
	alignment.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Adjust expected number of bytes allocated for alignof(max_align_t).

From-SVN: r265068
2018-10-12 00:21:11 +01:00
Jonathan Wakely cfef4c324a PR libstdc++/80538 Only call sleep for non-zero values
Avoid a system call when no sleep is required. Sleep in a loop (actually
two loops) to handle interruption by signals.

	PR libstdc++/80538
	* src/c++11/thread.cc (this_thread::__sleep_for)
	[_GLIBCXX_HAVE_SLEEP]: Only call sleep for non-zero values.
	Loop while sleep call is interrupted and until steady_clock
	shows requested duration has elapsed.
	(!_GLIBCXX_HAVE_USLEEP]: Use the _GLIBCXX_HAVE_SLEEP code path, but
	avoiding the usleep call.
	* testsuite/30_threads/this_thread/60421.cc: Test repeated
	signal interruptions.

From-SVN: r265044
2018-10-11 17:37:23 +01:00
Jonathan Wakely c7790bdbd9 Make ext allocators support heterogeneous equality comparison
The Allocator requirements include the ability to compare different
specializations of the same allocator class template. This did not work
for __gnu_cxx::new_allocator and other extension allocators.  This patch
replaces the equality operators for those allocators with inline friends
that support heterogeneous comparisons.  (I'm not changing all ext
allocators because some are bit-rotted already).

Additionally, the equality operators for comparing two std::allocator
objects of the same type are now defined as inline friends. Those
overloads don't need to be declared at namespace scope, because they
aren't specified in the standard (but they're needed in this
implementation to avoid ambiguities caused by the extra overloads
defined for the base allocator type).

	* include/bits/allocator.h
	(operator==(const allocator<_Tp>&, const allocator<_Tp>))
	(operator!=(const allocator<_Tp>&, const allocator<_Tp>)): Replace
	with inline friends.
	* include/ext/debug_allocator.h (operator==, operator!=): Replace
	with inline friend functions that compare to rebound allocators.
	* include/ext/malloc_allocator.h (operator==, operator!=): Likewise.
	* include/ext/new_allocator.h (operator==, operator!=): Likewise.
	* testsuite/ext/debug_allocator/eq.cc: New test.
	* testsuite/ext/ext_pointer/alloc_eq.cc: New test.
	* testsuite/ext/malloc_allocator/eq.cc: New test.
	* testsuite/ext/new_allocator/eq.cc: New test.

From-SVN: r265036
2018-10-11 12:32:29 +01:00
Jonathan Wakely 422a9f7789 PR libstdc++/87544 limit max_size() to PTRDIFF_MAX / sizeof(T)
The C++17 standard requires the default implementation for
allocator_traits::max_size to return SIZE_MAX / sizeof(value_type).
That causes GCC to warn because the value could be larger than can
sensibly be passed to malloc. This patch changes the new_allocator and
malloc_allocator max_size() members to use PTRDIFF_MAX instead of
SIZE_MAX (and because they define it, the allocator_traits default isn't
used). This also changes vector::max_size to impose a sensible limit
using PTRDIFF_MAX for cases where the value from the allocator or
allocator_traits is not sensible.

	PR libstdc++/87544
	* include/bits/stl_vector.h (vector::_S_max_size): Limit size to
	PTRDIFF_MAX / sizeof(value_type).
	* include/ext/malloc_allocator.h (malloc_allocator::max_size):
	Likewise.
	* include/ext/new_allocator.h (new_allocator::max_size): Likewise.
	* testsuite/23_containers/vector/allocator/minimal.cc: Adjust
	expected value for max_size().
	* testsuite/23_containers/vector/capacity/87544.cc: New test.

From-SVN: r265021
2018-10-10 16:39:33 +01:00
Jonathan Wakely aca0dcde1f PR libstdc++/87538 Verify fix for std::experimental::not_fn
PR libstdc++/87538
	* testsuite/experimental/functional/87538.cc: New test.

From-SVN: r264922
2018-10-08 13:17:58 +01:00
Jonathan Wakely 606f6be67b PR libstdc++/87538 fix std::not_fn exception specifications
PR libstdc++/87538
	* include/std/functional (_Not_fn::operator()): Check value of
	__is_nothrow_invocable as well.
	* testsuite/20_util/function_objects/not_fn/87538.cc: New test.

From-SVN: r264921
2018-10-08 13:07:22 +01:00
Joseph Myers 1c02928295 Use -fno-show-column in libstdc++ installed testing.
<https://gcc.gnu.org/ml/libstdc++/2016-08/msg00006.html> arranged for
libstdc++ tests to use -fno-show-column by default, but only for
build-tree testing.  This patch adds it to the options used for
installed testing as well.

Tested with installed testing for a cross to x86_64-linux-gnu, where
it fixes various test failures.

	* testsuite/lib/libstdc++.exp (libstdc++_init): Use
	-fno-show-column in default cxxflags.

From-SVN: r264784
2018-10-02 13:46:32 +01:00
François Dumont 9b29794962 re PR libstdc++/87135 ([C++17] unordered containers violate iterator validity requirements)
2018-09-21  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/87135
	* src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt):
	Use __builtin_floor to compute _M_next_resize.
	* testsuite/23_containers/unordered_set/hash_policy/71181.cc: Adapt.
	* testsuite/23_containers/unordered_set/hash_policy/prime_rehash.cc:
	Adapt.

From-SVN: r264494
2018-09-21 20:39:07 +00:00
Jonathan Wakely ac51f07ad2 Un-split hypot<long double> tests
Remove the hypot-long-double.cc file that used dg-xfail-run-if and
simply use the lower tolerance for double if long double is not larger
than double.

	* testsuite/26_numerics/headers/cmath/hypot-long-double.cc: Remove.
	* testsuite/26_numerics/headers/cmath/hypot.cc: Restore test for
	long double unconditionally, but use lower tolerance when
	sizeof(long double) == sizeof(double).

From-SVN: r264483
2018-09-21 16:36:53 +01:00
Christophe Lyon eb3f731774 hypot-long-double.cc: Skip on arm*.
2018-09-20  Christophe Lyon  <christophe.lyon@linaro.org>

	* testsuite/26_numerics/headers/cmath/hypot-long-double.cc: Skip
	on arm*.

From-SVN: r264443
2018-09-20 19:09:31 +02:00
François Dumont a521e62615 re PR libstdc++/87135 ([C++17] unordered containers violate iterator validity requirements)
2018-09-18  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/87135
	* src/c++11/hashtable_c++0x.cc:
	(_Prime_rehash_policy::_M_next_bkt): Return a prime no smaller than
	requested size, but not necessarily greater.
	(_Prime_rehash_policy::_M_need_rehash): Rehash only if target size is
	strictly greater than next resize threshold.
	* testsuite/23_containers/unordered_map/modifiers/reserve.cc: Adapt test
	to validate that there is no rehash as long as number of insertion is
	lower or equal to the reserved number of elements.

From-SVN: r264413
2018-09-18 20:36:16 +00:00
Jonathan Wakely a12c16de52 Fix location of invocable check for unique_ptr deleter
The deleter only needs to be invocable when the unique_ptr destructor
and reset member function are instantiated. In other contexts it might
not be possible to pass unique_ptr<T, D>::pointer to the deleter, if
that requires a derived-to-base conversion from T* and T is incomplete.

	* include/bits/unique_ptr.h (__uniq_ptr_impl): Remove static assertion
	checking invocable condition.
	(unique_ptr::~unique_ptr, unique_ptr::reset): Restore static assertion
	here, where types must be complete. Pass pointer to deleter as an
	rvalue.
	* testsuite/20_util/unique_ptr/requirements/incomplete.cc: New test.

From-SVN: r264399
2018-09-18 17:05:36 +01:00
Jonathan Wakely 9e2d426c17 PR libstdc++/87278 restore support for std::make_shared<volatile T>()
PR libstdc++/87278
	* include/bits/shared_ptr.h (make_shared): Use remove_cv instead of
	remove_const.
	* testsuite/20_util/shared_ptr/creation/87278.cc: New test.

From-SVN: r264207
2018-09-11 12:50:39 +01:00
Jonathan Wakely 86fc6ec9f3 Implement LWG 2905 changes to constrain unique_ptr constructors
LWG DR 2905 says that is_constructible_v<unique_ptr<P, D>, P, D const &>
should be false when D is not copy constructible. This commit implements
the changes from the DR and simplifies the signatures as per
https://github.com/cplusplus/draft/issues/1530

	* include/bits/unique_ptr.h (__uniq_ptr_impl): Add assertions to
	check deleter type.
	(unique_ptr::unique_ptr(pointer, const deleter_type&)): Add copy
	constructible constraint.
	(unique_ptr::unique_ptr(pointer, deleter_type&&)): Disable for
	deleters of reference type and add move constructible constraint.
	(unique_ptr::unique_ptr(pointer, remove_reference_t<deleter_type>&&)):
	Disable for deleters of non-reference type. Define as deleted.
	(unique_ptr<T[], D>): Likewise.
	* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Replace dg-error
	directives with unstable line numbers with dg-prune-output.
	* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/lwg2905.cc: New test.
	* testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc:
	Make deleter types invocable.

From-SVN: r264206
2018-09-11 11:55:49 +01:00
Jonathan Wakely d4baef5be8 PR libstdc++/78179 run long double tests separately
Split the long double testing into a separate file, so that we can XFAIL
targets where the long double precision doesn't meet the expected
tolerances. The float and double tests are still expefted to PASS for
all targets.

	PR libstdc++/78179
	* testsuite/26_numerics/headers/cmath/hypot-long-double.cc: New test
	that runs the long double part of hypot.cc.
	* testsuite/26_numerics/headers/cmath/hypot.cc: Disable long double
	tests unless TEST_HYPOT_LONG_DOUBLE is defined.

From-SVN: r264063
2018-09-03 15:54:28 +01:00
Jonathan Wakely 83a840a91f PR libstdc++/87194 fix range insertion into maps and sets
Since C++11 range insertion and construction of maps and sets from a
pair of iterators only requires that the iterator's value_type is
convertible to the container's value_type (previously it had to be the
same).

This fixes the implementation to meet that relaxed requirement, by
defining a pair of overloads that either insert or emplace, depending on
the iterator's value_type. Instead of adding yet another overload of
_M_insert_unique and _M_insert_equal, the overloads taking iterators are
renamed to _M_insert_range_unique and _M_insert_range_equal.

	PR libstdc++/87194
	* include/bits/stl_map.h
	(map::map(initializer_list<value_type>, const Compare&, const Alloc&))
	(map::map(initializer_list<value_type>, const Alloc&))
	(map::map(InputIterator, InputIterator, const Alloc&))
	(map::map(InputIterator, InputIterator))
	(map::map(InputIterator, InputIterator, const Compare&, const Alloc&))
	(map::insert(InputIterator, InputIterator)):
	Call _M_insert_range_unique instead of _M_insert_unique.
	* include/bits/stl_multimap.h
	(multimap::multimap(initializer_list<value_type>, const C&, const A&))
	(multimap::multimap(initializer_list<value_type>, const A&))
	(multimap::multimap(InputIterator, InputIterator, const A&))
	(multimap::multimap(InputIterator, InputIterator))
	(multimap::multimap(InputIterator, InputIterator, const C&, const A&))
	(multimap::insert(InputIterator, InputIterator)): Call
	_M_insert_range_equal instead of _M_insert_equal.
	* include/bits/stl_multiset.h
	(multiset::multiset(InputIterator, InputIterator))
	(multiset::multiset(InputIterator, InputIterator, const C&, const A&))
	(multiset::multiset(initializer_list<value_type>, const C&, const A&))
	(multiset::multiset(initializer_list<value_type>, const A&))
	(multiset::multiset(InputIterator, InputIterator, const A&))
	(multiset::insert(InputIterator, InputIterator)): Call
	_M_insert_range_equal instead of _M_insert_equal.
	* include/bits/stl_set.h
	(set::set(InputIterator, InputIterator))
	(set::set(InputIterator, InputIterator, const Compare&, const Alloc&))
	(set::set(initializer_list<value_type>, const Compare&, const Alloc&))
	(set::set(initializer_list<value_type>, const Alloc&))
	(set::set(InputIterator, InputIterator, const Alloc&))
	(set::insert(InputIterator, InputIterator)):
	Call _M_insert_range_unique instead of _M_insert_unique.
	* include/bits/stl_tree.h
	[__cplusplus >= 201103L] (_Rb_tree::__same_value_type): New alias
	template for SFINAE constraints.
	[__cplusplus >= 201103L] (_Rb_tree::_M_insert_range_unique): Pair of
	constrained overloads that either insert or emplace, depending on
	iterator's value_type.
	[__cplusplus >= 201103L] (_Rb_tree::_M_insert_range_equal): Likewise.
	[__cplusplus < 201103L] (_Rb_tree::_M_insert_range_unique)
	(_Rb_tree::_M_insert_range_equal): New functions replacing range
	versions of _M_insert_unique and _M_insert_equal.
	(_Rb_tree::_M_insert_unique(_InputIterator, _InputIterator))
	(_Rb_tree::_M_insert_equal(_InputIterator, _InputIterator)): Remove.
	* testsuite/23_containers/map/modifiers/insert/87194.cc: New test.
	* testsuite/23_containers/multimap/modifiers/insert/87194.cc: New test.
	* testsuite/23_containers/multiset/modifiers/insert/87194.cc: New test.
	* testsuite/23_containers/set/modifiers/insert/87194.cc: New test.

From-SVN: r264060
2018-09-03 15:25:25 +01:00
Jonathan Wakely bc62e155e4 PR libstdc++/78595 implement insertion into maps in terms of emplace
C++14 simplified the specification of the generic insert function
templates to be equivalent to calling emplace (or emplace_hint).
Defining them in terms of emplace takes care of the problems described
in PR 78595, ensuring a single conversion to value_type is done at the
right time.

	PR libstdc++/78595
	* include/bits/stl_map.h (map::insert(_Pair&&))
	(map::insert(const_iterator, _Pair&&)): Do emplace instead of insert.
	* include/bits/stl_multimap.h (multimap::insert(_Pair&&))
	(multimap::insert(const_iterator, _Pair&&)): Likewise.
	* include/bits/unordered_map.h (unordered_map::insert(_Pair&&))
	(unordered_map::insert(const_iterator, _Pair&&))
	(unordered_multimap::insert(_Pair&&))
	(unordered_multimap::insert(const_iterator, _Pair&&)): Likewise.
	* testsuite/23_containers/map/modifiers/insert/78595.cc: New test.
	* testsuite/23_containers/multimap/modifiers/insert/78595.cc: New test.
	* testsuite/23_containers/unordered_map/modifiers/78595.cc: New test.
	* testsuite/23_containers/unordered_multimap/modifiers/78595.cc: New
	test.

From-SVN: r264059
2018-09-03 15:25:12 +01:00
François Dumont b101633fa6 2018-09-02 François Dumont <fdumont@gcc.gnu.org>
* include/debug/safe_iterator.h
	(_Safe_iterator<_It, _Seq, _Cat>::_Self): New.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>::_Self):
	New.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
	::_OtherSelf): New.
	(_GLIBCXX_DEBUG_VERIFY_OPERANDS, _GLIBCXX_DEBUG_VERIFY_EQ_OPERANDS)
	(_GLIBCXX_DEBUG_VERIFY_REL_OPERANDS)
	(_GLIBCXX_DEBUG_VERIFY_DIST_OPERANDS): Define macros.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
	::operator+(difference_type)): Use latters, inline as friend.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
	::operator-(difference_type)): Likewise.
	(operator==(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator!=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator<(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator<=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator>(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator>=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator-(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator+(difference_type, const _Safe_iterator<>&)): Likewise.
	(operator-(const _Safe_iterator<>&, difference_type)): Likewise.
	* include/debug/safe_iterator.tcc
	(_Safe_iterator<>::_M_can_advance(difference_type)): Take parameter by
	copy.
	* include/debug/safe_local_iterator.h
	(_Safe_local_iterator<_It, _Seq>::_Self): New.
	(_Safe_local_iterator<_It, _Seq>::_OtherSelf): New.
	(_GLIBCXX_DEBUG_VERIFY_OPERANDS): Define macro.
	(operator==(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&)): Use latter, inline as friend.
	(operator!=(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&)): Likewise.
	* testsuite/util/testsuite_containers.h: Include utility.
	(struct forward_members_unordered<_Tp, bool>): Remove 2nd template
	parameter.
	(forward_members_unordered<>::forward_members_unordered(value_type&)):
	Add using namespace std::rel_ops.
	Add iterator_concept_checks on local_iterator and const_local_iterator.
	Add asserts on comparison between const_local_iterator and
	local_iterator.
	(struct forward_members_unordered<_Tp, false>): Remove partial
	specialization.
	* testsuite/23_containers/forward_list/types/1.cc: New.
	* testsuite/23_containers/list/types/1.cc: New.

From-SVN: r264039
2018-09-02 10:20:57 +00:00
Sandra Loosemore 6cec3c81a7 10.cc: Add dg-require-fileio.
2018-08-31  Sandra Loosemore  <sandra@codesourcery.com>

	libstdc++-v3/

	* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/10.cc:
	Add dg-require-fileio.
	* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/11.cc:
	Likewise.
	* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/wchar_t/2.cc:
	Likewise.
	* testsuite/25_algorithms/copy/streambuf_iterators/wchar_t/4.cc:
	Likewise.
	* testsuite/25_algorithms/find/istreambuf_iterators/wchar_t/2.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/close/wchar_t/12790-1.cc: Likewise.
	* testsuite/27_io/basic_filebuf/close/wchar_t/12790-2.cc: Likewise.
	* testsuite/27_io/basic_filebuf/close/wchar_t/12790-3.cc: Likewise.
	* testsuite/27_io/basic_filebuf/close/wchar_t/12790-4.cc: Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc: Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-1.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-2.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-3.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-4.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekpos/wchar_t/12790-1.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekpos/wchar_t/12790-2.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekpos/wchar_t/12790-4.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/underflow/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_filebuf/underflow/wchar_t/3.cc: Likewise.
	* testsuite/27_io/basic_ifstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ifstream/open/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_character/wchar_t/4.cc:
	Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/2.cc:
	Likewise.
	* testsuite/27_io/basic_istream/get/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_istream/getline/wchar_t/5.cc: Likewise.
	* testsuite/27_io/basic_istream/ignore/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_istream/ignore/wchar_t/3.cc: Likewise.
	* testsuite/27_io/basic_istream/seekg/wchar_t/sstream.cc: Likewise.
	* testsuite/27_io/basic_istream/tellg/wchar_t/sstream.cc: Likewise.
	* testsuite/27_io/basic_ofstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ofstream/open/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc:
	Likewise.
	* testsuite/27_io/objects/wchar_t/10.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-1.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-2.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-3.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-4.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-5.cc: Likewise.
	* testsuite/experimental/string_view/inserters/wchar_t/2.cc:
	Likewise.
	* testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc: Likewise.

From-SVN: r264022
2018-08-31 15:09:47 -04:00
Sandra Loosemore 24ce3d9485 noexcept30.C: Make dependence on -fdelete-null-pointer-checks explicit.
2018-08-30  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/testsuite/
	* g++.dg/cpp0x/noexcept30.C: Make dependence on
	-fdelete-null-pointer-checks explicit.
	* g++.dg/cpp1y/constexpr-82218.C: Likewise.
	* g++.dg/expr/pmf-3.C: Likewise.
	* g++.dg/ext/attr-returns-nonnull.C: Likewise.
	* g++.dg/tree-ssa/lifetime-dse1.C: Likewise.
	* g++.dg/tree-ssa/pr61034.C: Likewise.
	* gcc.dg/addr_equal-1.c: Likewise.
	* gcc.dg/ipa/pr85734.c: Likewise.
	* gcc.dg/ipa/propmalloc-1.c: Likewise.
	* gcc.dg/ipa/propmalloc-2.c: Likewise.
	* gcc.dg/ipa/propmalloc-3.c: Likewise.
	* gcc.dg/tree-ssa/pr78154.c: Likewise.
	* gcc.dg/tree-ssa/pr83648.c: Likewise.

	libstdc++-v3/
	* testsuite/experimental/propagate_const/observers/1.cc: Make
	dependence on -fdelete-null-pointer-checks explicit.

From-SVN: r264001
2018-08-30 17:27:44 -04:00
Jonathan Wakely 2fb17d2d90 Avoid undefined shifts in ceil2 operations
For values where the result cannot be represented the shift width would
be equal to the width of the type, which is undefined. Perform two
well-defined shifts instead of one possible undefined shift.

	* include/bits/hashtable_policy.h (__clp2): Fix calculation for LLP64
	targets where sizeof(size_t) > sizeof(long). Avoid undefined shifts
	of the number of bits in the type.
	* include/std/bit (__ceil2): Avoid undefined shifts.
	* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: Test values with
	the most signifiant bit set.

From-SVN: r263986
2018-08-30 16:07:35 +01:00
Jonathan Wakely 4a559e91b1 Fix __gnu_cxx::_Pointer_adapter for long long arithmetic
* include/ext/pointer.h (_Pointer_adapter): Define operators for
	pointer arithmetic using long long offsets.
	* testsuite/ext/ext_pointer/1.cc: Test pointer arithmetic using
	long long values.

From-SVN: r263976
2018-08-30 13:24:06 +01:00
Jonathan Wakely 9111b08384 PR libstdc++/31413 fix test failure on Debian systems
Debian uses a different D_FMT string for the zh_TW.UTF-8 locale, which
caused this test to fail. Try to detect the Debian format and adjust
the input being tested.

	PR libstdc++/31413
	* testsuite/22_locale/time_get/get_date/wchar_t/4.cc: Check D_FMT
	string for alternative format.

From-SVN: r263948
2018-08-29 11:05:55 +01:00
Jonathan Wakely dd35da2cbe PR libstdc++/87116 fix path::lexically_normal() handling of dot-dot
Previously the logic that turned "a/b/c/../.." into "a/" failed to
preserve an empty path at the end of the iteration sequence, as required
by the trailing slash. That meant the result didn't meet the class
invariants, and that "a/b/c/d/../../.." would remove four components
instead of the three that "../../.." should remove.

	PR libstdc++/87116
	* src/filesystem/std-path.cc (path::lexically_normal): When handling
	a dot-dot filename, preserve an empty final component in the iteration
	sequence.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use preferred-separator for
	root-directory.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Add new tests
	for more than two adjacent dot-dot filenames.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Replace slashes with
	preferred-separator in expected normalized strings.

From-SVN: r263922
2018-08-28 16:33:53 +01:00
Jonathan Wakely 9ca2ac699a Forward declare debug containers so std::pmr aliases work
Prior to this change, including a <debug/xxx> header when _GLIBCXX_DEBUG
is also defined would fail to compile in C++17 or later. The <debug/xxx>
header would include the standard <xxx> header which defined
std::pmr::xxx as an alias for std::xxx. But in Debug Mode std::xxx
refers to std::__debug::xxx which has not been defined yet (because it
is in <debug/xxx> after the inclusion of <xxx>).

This adds declarations of the debug containers before including the
non-Debug Mode <xxx> header, so that the std::pmr::xxx aliases work.

	* include/debug/deque (std::__debug::deque): Declare.
	* include/debug/forward_list (std::__debug::forward_list): Declare.
	* include/debug/list (std::__debug::list): Declare.
	* include/debug/map (std::__debug::map): Declare.
	* include/debug/set (std::__debug::set): Declare.
	* include/debug/unordered_map (std::__debug::unordered_map): Declare.
	* include/debug/unordered_set (std::__debug::unordered_set): Declare.
	* include/debug/vector (std::__debug::vector): Declare.
	* testsuite/23_containers/deque/types/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/forward_list/pmr_typedefs_debug.cc: New
	test.
	* testsuite/23_containers/list/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/map/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/multimap/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/multiset/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/set/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/unordered_map/pmr_typedefs_debug.cc: New
	test.
	* testsuite/23_containers/unordered_multimap/pmr_typedefs_debug.cc:
	New test.
	* testsuite/23_containers/unordered_multiset/pmr_typedefs_debug.cc:
	New test.
	* testsuite/23_containers/unordered_set/pmr_typedefs_debug.cc: New
	test.
	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc:
	Adjust dg-error lineno.
	* testsuite/23_containers/vector/types/pmr_typedefs_debug.cc: New
	test.

From-SVN: r263839
2018-08-24 18:43:18 +01:00
Jonathan Wakely 763ef11bff Fix failure when -fno-rtti test is run in C++17 or later
* testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource):
	Only define when RTTI is enabled.

From-SVN: r263820
2018-08-23 20:27:54 +01:00
Jonathan Wakely c07870270a Fix C++98 tests to not use C++11 features.
* testsuite/25_algorithms/partial_sort_copy/debug/irreflexive_neg.cc:
	Fix C++98 test to not use C++11 features.
	* testsuite/25_algorithms/fill_n/2.cc: Likewise.

From-SVN: r263815
2018-08-23 16:10:45 +01:00
Jonathan Wakely 3eb1eda1c8 Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.

	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::__const_iterator): Change access to protected.
	[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
	as typedef for iterator.
	* include/debug/string (__const_iterator): Use typedef from base.
	(insert(const_iterator, _CharT))
	(replace(const_iterator, const_iterator, const basic_string&))
	(replace(const_iterator, const_iterator, const _CharT*, size_type))
	(replace(const_iterator, const_iterator, const CharT*))
	(replace(const_iterator, const_iterator, size_type, _CharT))
	(replace(const_iterator, const_iterator, _InputIter, _InputIter))
	(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
	Change const_iterator parameters to __const_iterator.
	(insert(iterator, size_type, _CharT)): Add C++98 overload.
	(insert(const_iterator, _InputIterator, _InputIterator)): Change
	const_iterator parameter to __const_iterator.
	[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
	of base's member function.
	(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
	Likewise.
	(insert(const_iterator, initializer_list<_CharT>))
	[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
	* testsuite/21_strings/basic_string/init-list.cc: Remove effective
	target directive.

From-SVN: r263808
2018-08-23 11:51:52 +01:00
Jonathan Wakely 0aa2934aaa Remove C++14-isms from C++11 tests
* testsuite/20_util/reference_wrapper/lwg2993.cc: Fix C++11 test to
	not use C++14 feature.
	* testsuite/23_containers/list/68222_neg.cc: Likewise.

From-SVN: r263801
2018-08-23 09:26:22 +01:00
Jonathan Wakely 75224273c3 Skip tests that depend on the cxx11 std::string
* testsuite/21_strings/basic_string/init-list.cc:
	Require cxx11-abi.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc:
	Likewise.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
	Likewise.

From-SVN: r263800
2018-08-23 09:26:16 +01:00
Jonathan Wakely f73a5316b6 Fix tests that fail in C++98 mode
* testsuite/23_containers/deque/capacity/max_size.cc: Fix test for
	C++98 mode.
	* testsuite/23_containers/deque/modifiers/assign/1.cc: Likewise.
	* testsuite/23_containers/list/modifiers/assign/1.cc: Likewise.
	* testsuite/23_containers/vector/bool/modifiers/assign/1.cc: Likewise.
	* testsuite/23_containers/vector/capacity/max_size.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/assign/1.cc: Likewise.

From-SVN: r263792
2018-08-23 00:43:43 +01:00
Jonathan Wakely 1bc7a28f94 PR libstdc++/87061 remove pmr type aliases for COW strings
The pmr aliases for basic_string and match_results are incompatible with
the gcc4-compatible ABI because the Copy-On-Write basic_string class
doesn't support C++11 allocators.

	PR libstdc++/87061
	* include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
	(experimental::pmr::match_results, experimental::pmr::cmatch)
	(experimental::pmr::smatch, experimental::pmr::wcmatch)
	(experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
	because COW strings don't support C++11 allocator model.
	* include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
	(experimental::pmr::basic_string, experimental::pmr::string)
	(experimental::pmr::u16string, experimental::pmr::u32string)
	(experimental::pmr::wstring): Likewise.
	* include/std/regex [!_GLIBCXX_USE_CXX11_ABI] (pmr::match_results)
	(pmr::cmatch, pmr::smatch, pmr::wcmatch, pmr::wsmatch): Likewise.
	* include/std/string [!_GLIBCXX_USE_CXX11_ABI] (pmr::basic_string)
	(pmr::string, pmr::u16string, pmr::u32string, pmr::wstring): Likewise.
	* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Require
	cxx11-abi.
	* testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise.

From-SVN: r263791
2018-08-22 23:54:33 +01:00
Jonathan Wakely af55b3af33 PR libstdc++/78448 limit vector::max_size and deque::max_size
The container requirements imply that max_size() can't exceed the
maximum value of the container's difference_type. Enforce this for
std::vector and std::deque, and add checks to ensure the container
doesn't grow larger than that.

	PR libstdc++/78448
	* include/bits/deque.tcc (deque::_M_range_initialize): Use
	_S_check_init_len to check size.
	(deque::_M_push_back_aux, deque::_M_push_front_aux): Throw length
	error if size would exceed max_size().
	* include/bits/stl_deque.h (_Deque_base::size_type): Remove typedef.
	(_Deque_base(_Deque_base&&, const allocator_type&, size_t)): Use
	size_t instead of size_type.
	(deq(size_type, const allocator_type&)
	(deq(size_type, const value_type&, const allocator_type&)
	(deque::_M_initialize_dispatch): Use _S_check_init_len to check size.
	(deque::max_size): Call _S_max_size.
	(deque::_S_check_init_len, deque::_S_max_size): New functions.
	* include/bits/stl_vector.h (vector(size_type, const allocator_type&))
	(vector(size_type, const value_type&, const allocator_type&))
	(vector::_M_initialize_dispatch, vector::_M_range_initialize): Use
	_S_check_init_len to check size.
	(vector::max_size): Call _S_max_size.
	(vector::_M_check_len): Prevent max from being expanded as a
	function-like macro.
	(vector::_S_check_init_len, vector::_S_max_size): New functions.
	* include/bits/vector.tcc (vector::_M_assign_aux): Use
	_S_check_init_len to check size.
	* testsuite/23_containers/deque/capacity/max_size.cc: New test.
	* testsuite/23_containers/vector/capacity/max_size.cc: New test.

From-SVN: r263789
2018-08-22 23:22:40 +01:00
François Dumont e9afbed0d6 re PR libstdc++/68222 (_Safe_iterator provides operators the wrapped iterator can't actually support)
2018-08-22  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/68222
	* include/debug/safe_iterator.h
	(_Safe_iterator<_It, _Sq, _Cat>): Add category template parameter.
	(_Safe_iterator<>::_Const_iterator): Remove.
	(_Safe_iterator<>::_IsConstant): New.
	(_Safe_iterator<>::_OtherIterator): New.
	(_Safe_iterator<_It, _Sq, _Cat>::_Safe_iterator<_MutIte>(
	const _Safe_iterator<_MutIte, _Sq, _Cat>&)): Add _IsConstant::__value in
	__gnu_cxx::__enable_if condition.
	(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_to): New.
	(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_from_begin): New.
	(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_to_end): New.
	(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>): New.
	(_Safe_iterator<_It, _Sq, _Cat>::operator--()): Move...
	(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
	::operator--()): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator--(int)): Move...
	(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
	::operator--(int)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::_M_decrementable()): Move...
	(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
	::_M_decrementable()): ...here.
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>): New.
	(_Safe_iterator<_It, _Sq, _Cat>::operator[](const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator[](const difference_type&)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator+=(const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator+=(const difference_type&)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator+(const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator+(const difference_type&)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator-=(const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator-=(const difference_type&)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator-(const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator-(const difference_type&)): ...here.
	(operator<(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Constraint to random access iterators.
	(operator<=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator>(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator>=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator-(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator+(const difference_type&, const _Safe_iterator<>&)): Likewise.
	(__check_dereferenceable(const _Safe_iterator<>&)): Remove.
	(__get_distance): Remove.
	(__get_distance_from_begin): Remove.
	(__get_distance_to_end): Remove.
	(struct __is_safe_random_iterator<_Safe_iterator<>>): Remove partial
	specialization.
	(__base(const _Safe_iterator<>&, std::input_iterator_tag)): Remove.
	(__base(const _Safe_iterator<>&, std::random_access_iterator_tag)): Remove.
	(__base(const _Safe_iterator<>&)): Constraint to random access iterator.
	* include/debug/safe_iterator.tcc
	(_Safe_iterator<>::_M_get_distance_from_begin()): New.
	(_Safe_iterator<>::_M_get_distance_to_end()): New.
	(_Safe_iterator<>::_M_get_distance_to(const _Safe_iterator<>&)): New.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
	::_M_valid_range): New.
	* include/debug/safe_local_iterator.h
	(_Safe_local_iterator<>::_Const_local_iterator): Remove.
	(_Safe_local_iterator<>::_IsConstant): New.
	(_Safe_local_iterator<>::_OtherIterator): New.
	(_Safe_local_iterator<_It, _Cont>::_Safe_local_iterator<_MutIte, _Cont>(
	const _Safe_local_iterator<_MutIte, _Seq>&)): Add _IsConstant::__value
	in __gnu_cxx::__enable_if condition. If singular compare base iterator
	with _MutIte rather than _It.
	(_Safe_local_iterator<>::_S_constant): Make constexpr.
	(_Safe_local_iterator<>::_M_get_distance_to): New.
	(__check_dereferenceable(const _Safe_local_iterator<>&)): Remove.
	(__get_distance(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&, std::input_iterator_tag)): Remove.
	(__valid_range(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&)): New.
	* include/debug/safe_local_iterator.tcc
	(_Safe_local_iterator<>::_M_get_distance_to): New.
	* include/debug/deque (std::__debug::deque<>): Add
	::__gnu_debug::_Safe_iterator<> friend declaration.
	* include/debug/forward_list (std::__debug::forward_list<>): Likewise.
	* include/debug/list (std::__debug::list<>): Likewise.
	* include/debug/map.h (std::__debug::map<>): Likewise.
	* include/debug/multimap.h (std::__debug::multimap<>): Likewise.
	* include/debug/set.h (std::__debug::set<>): Likewise.
	* include/debug/multiset.h (std::__debug::multiset<>): Likewise.
	* include/debug/string (std::__debug::basic_string<>): Likewise.
	* include/debug/unordered_map (std::__debug::unordered_map<>): Likewise
	and add ::__gnu_debug::_Safe_local_iterator<> friend declaration.
	(std::__debug::unordered_multimap<>): Likewise.
	* include/debug/unordered_set (std::__debug::unordered_set<>): Likewise.
	(std::__debug::unordered_multiset<>): Likewise.
	* include/debug/formatter.h: Adapt.
	* include/debug/helper_functions.h
	(__gnu_debug::_Safe_local_iterator<>): Add declaration.
	(__get_distance<_Ite>(_Ite, _Ite, std::random_access_iterator_tag):
	Pass parameter by copy.
	(__get_distance<_Ite>(_Ite, _Ite, std::input_iterator_tag): Likewise.
	(__get_distance<_Ite>(_Ite, _Ite): Likewise.
	(__valid_range_aux<_Integral>): Pass _Integral by copy.
	(__valid_range<_InputIterator>): Pass _InputIterator by copy.
	(__valid_range<>(const _Safe_iterator<>&,
	const _Safe_iterator<>&, typename _Distance_traits<>::__type&)):
	Declare.
	(__valid_range(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&, typename _Distance_traits<>::__type&)):
	Declare.
	(__valid_range<>(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Declare.
	(__valid_range(const _Safe_local_iterator<>&, const _Safe_local_iterator<>&)):
	Declare.
	(__can_advance): Adapt.
	(struct __is_safe_random_iterator<>): Remove.
	(struct _SIter_base<>): Remove.
	* include/debug/functions.h: Include <bits/stl_iterator.h>.
	(__check_dereferenceable): Remove.
	(__foreign_iterator_aux4, __foreign_iterator_aux3): Adapt.
	(__foreign_iterator_aux2, __foreign_iterator_aux): Adapt.
	(__foreign_iterator): Adapt.
	* include/debug/stl_iterator.h
	(__is_safe_random_iterator<std::reverse_iterator<>>): Remove.
	(__base(const std::reverse_iterator<_Safe_iterator<_It, _Sq>)):
	Constraint for random access iterators.
	(__niter_base): Adapt.
	* testsuite/util/testsuite_containers.h:
	Include <bits/boost_concept_check.h>.
	(iterator_concept_checks<_It, _Mutable, _Category>): New.
	(citerator<_Cont>::forward_members::forward_members()): Instantiate
	latter for container iterator and const_iterator.
	* testsuite/23_containers/list/68222_neg.cc: New.
	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Adapt
	line number.
	* testsuite/23_containers/unordered_set/debug/debug_functions.cc:
	(test01): Remove.
	* testsuite/23_containers/vector/debug/debug_functions.cc (test01):
	Remove.

From-SVN: r263786
2018-08-22 18:51:25 +00:00
David Edelsohn bce17c392a * testsuite/18_support/new_nothrow.cc: XFAIL on AIX.
From-SVN: r263703
2018-08-21 10:03:16 -04:00
Jonathan Wakely 25d4036370 Remove redundant { dg-do run } directives in tests
These tests accidentally had two dg-do directives. Only the second one
is needed.

	* testsuite/26_numerics/bit/bitops.count/countl_one.cc: Remove
	redundant dg-do directive.
	* testsuite/26_numerics/bit/bitops.count/countl_zero.cc: Likewise.
	* testsuite/26_numerics/bit/bitops.count/countr_one.cc: Likewise.
	* testsuite/26_numerics/bit/bitops.count/countr_zero.cc: Likewise.
	* testsuite/26_numerics/bit/bitops.count/popcount.cc: Likewise.

From-SVN: r263695
2018-08-21 10:34:26 +01:00
Jonathan Wakely b655b8fc7e Refactor std::optional SFINAE constraints
* include/std/optional (_Optional_payload): Use variable templates
	for conditions in default template arguments and exception
	specifications.
	(optional): Likewise. Adjust indentation.
	(optional::__not_self, optional::__not_tag, optional::_Requires): New
	SFINAE helpers.
	(optional::optional): Use new helpers in constructor constraints.
	* include/std/type_traits (__or_v, __and_v): New variable templates.
	* testsuite/20_util/optional/cons/value_neg.cc: Change dg-error to
	dg-prune-output. Remove unused header.

From-SVN: r263657
2018-08-20 13:13:25 +01:00
François Dumont 6672e849b8 86658.cc: Use dg-options to define _GLIBCXX_DEBUG.
2018-08-18  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/25_algorithms/copy/86658.cc: Use dg-options to define
	_GLIBCXX_DEBUG.

From-SVN: r263647
2018-08-18 20:01:14 +00:00
Jonathan Wakely 478490f681 PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment
PR libstdc++/86963
	* include/std/tuple (__tuple_base): New class template with deleted
	copy assignment operator.
	(tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that
	implicit copy/move assignment operator will be deleted/suppressed.
	(tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper
	functions for SFINAE constraints on assignment operators.
	(tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable):
	New helper functions for exception specifications.
	(tuple::operator=(const tuple&), tuple::operator=(tuple&&))
	(tuple<_T1, _T2>::operator=(const tuple&))
	(tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to
	__nonesuch_no_braces when the operator should be defined implicitly.
	Use __nothrow_assignable for exception specifications.
	(tuple::operator=(const tuple<_UElements...>&))
	(tuple::operator=(tuple<_UElements...>&&))
	(tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&))
	(tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&))
	(tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&))
	(tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using
	__assignable and use __nothrow_assignable for exception
	specifications.
	* python/libstdcxx/v6/printers.py (is_specialization_of): Accept
	gdb.Type as first argument, instead of a string.
	(StdTuplePrinter._iterator._is_nonempty_tuple): New method to check
	tuple for expected structure.
	(StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple.
	* testsuite/20_util/tuple/dr2729.cc: New test.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error
	to dg-prune-output.

From-SVN: r263625
2018-08-17 18:52:49 +01:00
Jonathan Wakely b8eac4d064 Fix experimental::pmr typedefs and add tests
The typedefs in <experimental/regex> and <experimental/string> don't
need to be in the __cxx11 namespace, because they are only aliases and
so will have the same mangled name as the underlying types.

	* include/experimental/regex: Remove begin/end macros for namespace.
	* include/experimental/string: Likewise.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_forward_list.cc: New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_multimap.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_multiset.cc: New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_map.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_multimap.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_multiset.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_set.cc: New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc:
	New test.

From-SVN: r263568
2018-08-15 20:46:25 +01:00
Jonathan Wakely b479fbad24 Refactor uses-allocator construction
Remove duplicated logic in experimental::pmr::polymorphic_allocator by
calling the __uses_allocator_construct helper.

Fix bugs in std::pmr::polymorphic_allocator with incorrect SFINAE
constraint and incorrect argument order.

	* include/bits/uses_allocator.h (__uses_allocator_construct): Qualify
	calls to __uses_allocator_construct_impl and __use_alloc.
	* include/experimental/memory_resource
	(polymorphic_allocator::_M_construct): Remove.
	(polymorphic_allocator::construct): Call __uses_allocator_construct.
	Qualify calls to __use_alloc.
	* include/std/memory_resource (polymorphic_allocator::construct): Fix
	type in SFINAE constraint. Use constexpr if instead of tag dispatching
	to _S_construct overloads.
	(polymorphic_allocator::construct(pair<T1, T2>*, ...)): Fix order of
	arguments to _S_construct_p.
	(polymorphic_allocator::_S_construct): Remove.
	(polymorphic_allocator::_S_construct_p): Return allocators by value
	not by reference.
	* include/std/scoped_allocator (scoped_allocator_adaptor::construct):
	Qualify calls to __use_alloc.
	* testsuite/20_util/polymorphic_allocator/construct_pair.cc: New test,
	copied from testsuite/20_util/scoped_allocator/construct_pair.cc.
	* testsuite/experimental/polymorphic_allocator/1.cc: New test.
	* testsuite/experimental/polymorphic_allocator/construct_pair.cc:
	New test.

From-SVN: r263566
2018-08-15 20:20:02 +01:00
Jeremy Sawicki 3ffa55de60 Rope iterators: don't retain pointers when copied
Rope iterators sometimes contain pointers to an internal buffer
inside the iterator itself.  When such an iterator is copied, the
copy incorrectly retains pointers to the original.

This patch takes the simple approach of not copying the cached
information when the internal buffer is being used, instead
requiring it to be recomputed when the copied iterator is
dereferenced.  An alternative would be to adjust the pointers so
they refer to the buffer in the copy.

2018-08-14  Jeremy Sawicki  <jeremy-gcc@sawicki.us>

	* include/ext/rope (_Rope_iterator_base(const _Rope_iterator_base&))
	(_Rope_const_iterator::operator=(const _Rope_const_iterator&))
	(_Rope_iterator::operator=(const _Rope_iterator&)): Ensure
	copied/assigned rope iterators don't retain pointers to the iterator
	they were copied/assigned from.
	* testsuite/ext/rope/7.cc: New.

From-SVN: r263534
2018-08-14 12:23:50 +01:00
Jonathan Wakely 7997ede243 Add <bit> and <version> to freestanding headers
* include/Makefile.am: Install <bit> and <version> for freestanding.
	* include/Makefile.in: Regenerate.
	* testsuite/17_intro/freestanding.cc: Check for <bit> and <version>.

From-SVN: r263514
2018-08-13 19:54:34 +01:00
Jonathan Wakely b66e5a95c0 PR libstdc++/68210 adjust operator new and delete for LWG 206
Ensure that nothrow versions of new and delete call the ordinary
versions of new or delete, instead of calling malloc or free directly.

These files are all compiled with -std=gnu++14 so can use noexcept and
nullptr to make the code more readable.

	PR libstdc++/68210
	* doc/xml/manual/intro.xml: Document LWG 206 change.
	* libsupc++/del_op.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
	* libsupc++/del_opa.cc: Likewise.
	* libsupc++/del_opant.cc: Likewise.
	* libsupc++/del_opnt.cc: Likewise. Call operator delete(ptr) instead
	of free(ptr).
	* libsupc++/del_ops.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
	* libsupc++/del_opsa.cc: Likewise.
	* libsupc++/del_opva.cc: Likewise.
	* libsupc++/del_opvant.cc: Likewise.
	* libsupc++/del_opvnt.cc: Likewise. Call operator delete[](ptr)
	instead of operator delete(ptr).
	* libsupc++/del_opvs.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
	* libsupc++/del_opvsa.cc: Likewise.
	* libsupc++/new_op.cc: Use __builtin_expect in check for zero size.
	* libsupc++/new_opa.cc: Use nullptr instead of literal 0.
	* libsupc++/new_opant.cc: Likewise. Replace _GLIBCXX_USE_NOEXCEPT
	with noexcept.
	* libsupc++/new_opnt.cc: Likewise. Call operator new(sz) instead of
	malloc(sz).
	* libsupc++/new_opvant.cc: Use nullptr and noexcept.
	* libsupc++/new_opvnt.cc: Likewise. Call operator new[](sz) instead of
	operator new(sz, nothrow).
	* testsuite/18_support/new_nothrow.cc: New test.

From-SVN: r263478
2018-08-10 21:20:27 +01:00
Jonathan Wakely 1fc9d0b0e4 Define aliases for containers using polymorphic_allocator
These aliases are placed in the top-level header, e.g. <vector> not
<bits/stl_vector.h>. This ensures that they refer to whichever of
std::vector or __debug::vector or __profile::vector is in use when the
header is included.

	* include/std/deque (std::pmr::deque): Declare alias.
	* include/std/forward_list (std::pmr::forward_list): Likewise.
	* include/std/list (std::pmr::list): Likewise.
	* include/std/map (std::pmr::map, std::pmr::multimap): Likewise.
	* include/std/regex (std::pmr::match_results, std::pmr::cmatch)
	(std::pmr::smatch, std::pmr::wcmatch, std::pmr::wsmatch): Likewise.
	* include/std/set (std::pmr::set, std::pmr::multiset): Likewise.
	* include/std/string (std::pmr::basic_string, std::pmr::string)
	(std::pmr::u16string, std::pmr::u32string, std::pmr::wstring):
	Likewise.
	* include/std/unordered_map (std::pmr::unordered_map)
	(std::pmr::unordered_multimap): Likewise.
	* include/std/unordered_set (std::pmr::unordered_set)
	(std::pmr::unordered_multiset): Likewise.
	* include/std/vector (std::pmr::vector): Likewise.
	* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: New test.
	* testsuite/23_containers/deque/types/pmr_typedefs.cc: New test.
	* testsuite/23_containers/forward_list/pmr_typedefs.cc: New test.
	* testsuite/23_containers/list/pmr_typedefs.cc: New test.
	* testsuite/23_containers/map/pmr_typedefs.cc: New test.
	* testsuite/23_containers/multimap/pmr_typedefs.cc: New test.
	* testsuite/23_containers/multiset/pmr_typedefs.cc: New test.
	* testsuite/23_containers/set/pmr_typedefs.cc: New test.
	* testsuite/23_containers/unordered_map/pmr_typedefs.cc: New test.
	* testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: New
	test.
	* testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: New
	test.
	* testsuite/23_containers/unordered_set/pmr_typedefs.cc: New test.
	* testsuite/23_containers/vector/pmr_typedefs.cc: New test.
	* testsuite/28_regex/match_results/pmr_typedefs.cc: New test.

From-SVN: r263456
2018-08-10 00:25:53 +01:00
Jonathan Wakely d3f3c68099 PR libstdc++/86597 directory_entry observers should clear error_code
PR libstdc++/86597
	* include/bits/fs_dir.h (directory_entry::_M_file_type(error_code&)):
	Clear error_code when cached type is used.
	* testsuite/27_io/filesystem/directory_entry/86597.cc: New test.

From-SVN: r263397
2018-08-08 14:09:19 +01:00
Jonathan Wakely 0ec78a9369 PR libstdc++/86874 fix std::variant::swap regression
PR libstdc++/86874
	* include/std/variant (_Copy_ctor_base::_M_destructive_move): Define
	here instead of in _Move_assign_base.
	(_Copy_ctor_base<true, _Types...>::_M_destructive_move): Define.
	(_Copy_assign_base::operator=): Use _M_destructive_move when changing
	the contained value to another alternative.
	(_Move_assign_base::operator=): Likewise.
	(_Move_assign_base::_M_destructive_move): Remove.
	* testsuite/20_util/variant/86874.cc: New test.

From-SVN: r263365
2018-08-07 20:13:26 +01:00
Jonathan Wakely d7487e2ae8 Add workaround for non-unique errno values on AIX
* src/c++11/system_error.cc
	(system_error_category::default_error_condition): Add workaround for
	ENOTEMPTY and EEXIST having the same value on AIX.
	* testsuite/19_diagnostics/error_category/system_category.cc: Add
	extra testcases for EDOM, EILSEQ, ERANGE, EEXIST and ENOTEMPTY.

From-SVN: r263289
2018-08-03 13:53:34 +01:00
Mike Crowe 2f59343265 Report early wakeup of condition_variable::wait_until as no_timeout
As currently implemented, condition_variable always ultimately waits
against std::chrono::system_clock. This clock can be changed in arbitrary
ways by the user which may result in us waking up too early or too late
when measured against the caller-supplied clock.

We can't (yet) do much about waking up too late (PR 41861), but
if we wake up too early we must return cv_status::no_timeout to indicate a
spurious wakeup rather than incorrectly returning cv_status::timeout.

2018-08-01  Mike Crowe  <mac@mcrowe.com>

	* include/std/condition_variable (wait_until): Only report timeout
	if we really have timed out when measured against the
	caller-supplied clock.
	* testsuite/30_threads/condition_variable/members/2.cc: Add test
	case to confirm above behaviour.

From-SVN: r263224
2018-08-01 16:39:45 +01:00
Jonathan Wakely 5ecfbf82a4 PR libstdc++/60555 std::system_category() should recognise POSIX errno values
PR libstdc++/60555
	* src/c++11/system_error.cc
	(system_error_category::default_error_condition): New override to
	check for POSIX errno values.
	* testsuite/19_diagnostics/error_category/generic_category.cc: New
	* testsuite/19_diagnostics/error_category/system_category.cc: New
	test.

From-SVN: r263210
2018-08-01 14:57:05 +01:00
Jonathan Wakely e182158261 PR libstdc++/86751 default assignment operators for std::pair
The solution for PR 77537 causes ambiguities due to the extra copy
assignment operator taking a __nonesuch_no_braces parameter. By making
the base class non-assignable we don't need the extra deleted overload
in std::pair. The copy assignment operator will be implicitly deleted
(and the move assignment operator not declared) as needed. Without the
additional user-provided operator in std::pair the ambiguity is avoided.

	PR libstdc++/86751
	* include/bits/stl_pair.h (__pair_base): New class with deleted copy
	assignment operator.
	(pair): Derive from __pair_base.
	(pair::operator=): Remove deleted overload.
	* python/libstdcxx/v6/printers.py (StdPairPrinter): New pretty printer
	so that new base class isn't shown in GDB.
	* testsuite/20_util/pair/86751.cc: New test.
	* testsuite/20_util/pair/ref_assign.cc: New test.

From-SVN: r263185
2018-07-31 23:31:20 +01:00
Jonathan Wakely a64ede727f PR libstdc++/86734 make reverse_iterator::operator-> more robust
Implement the proposed resolution from LWG 1052, which also resolves
DR 2118 by avoiding taking the address in the first place.

	PR libstdc++/86734
	* include/bits/stl_iterator.h (reverse_iterator::operator->): Call
	_S_to_pointer (LWG 1052, LWG 2118).
	(reverse_iterator::_S_to_pointer): Define overloaded helper functions.
	* testsuite/24_iterators/reverse_iterator/dr1052.cc: New test.
	* testsuite/24_iterators/reverse_iterator/dr2188.cc: New test.

From-SVN: r263074
2018-07-30 18:13:05 +01:00
Jonathan Wakely 1b3b888d11 Add workaround for aligned_alloc bug on AIX
20_util/memory_resource/2.cc FAILs on AIX 7.2.0.0, because aligned_alloc
incorrectly requires the alignment to be a multiple of sizeof(void*).

This adds a workaround to the operator new overload taking an alignment
value, to increase the alignment (and size) if needed.

	* libsupc++/new_opa.cc (operator new(size_t, align_val_t)): Add
	workaround for aligned_alloc bug on AIX.
	* testsuite/18_support/new_aligned.cc: New test.

From-SVN: r263073
2018-07-30 18:12:44 +01:00
Marek Polacek ccfe77fa22 * 30_threads/condition_variable_any/cond.cc: New test.
From-SVN: r263022
2018-07-26 21:23:12 +00:00
Jonathan Wakely 49ba258864 Add missing dg-require-cstdint directives to tests
* testsuite/18_support/aligned_alloc/aligned_alloc.cc: Add
	dg-require-cstdint directive.
	* testsuite/20_util/allocator/overaligned.cc: Likewise.
	* testsuite/20_util/any/cons/aligned.cc: Likewise.
	* testsuite/20_util/monotonic_buffer_resource/allocate.cc: Likewise.
	* testsuite/20_util/monotonic_buffer_resource/deallocate.cc: Likewise.
	* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
	Likewise.
	* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise.
	* testsuite/23_containers/list/modifiers/insert/25288.cc: Likewise.
	* testsuite/23_containers/set/allocator/move_assign.cc: Likewise.
	* testsuite/25_algorithms/make_heap/complexity.cc: Likewise.
	* testsuite/25_algorithms/pop_heap/complexity.cc: Require cstdint and
	random_device effective-target.
	* testsuite/25_algorithms/push_heap/complexity.cc: Likewise.
	* testsuite/25_algorithms/sample/1.cc: Require cstdint.
	* testsuite/25_algorithms/sample/2.cc: Likewise.
	* testsuite/25_algorithms/sort_heap/complexity.cc: Require cstdint
	and random_device.
	* testsuite/26_numerics/headers/random/types_std_c++0x.cc: Require
	cstdint.
	* testsuite/26_numerics/random/chi_squared_distribution/83833.cc:
	Likewise.
	* testsuite/26_numerics/random/discard_block_engine/requirements/
	constexpr_data.cc: Likewise.
	* testsuite/26_numerics/random/discard_block_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/independent_bits_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/linear_congruential_engine/requirements/
	constexpr_data.cc: Likewise.
	* testsuite/26_numerics/random/linear_congruential_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/mersenne_twister_engine/requirements/
	constexpr_data.cc: Likewise.
	* testsuite/26_numerics/random/mersenne_twister_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/pr60037-neg.cc: Likewise.
	* testsuite/26_numerics/random/seed_seq/cons/65631.cc: Likewise.
	* testsuite/26_numerics/random/shuffle_order_engine/requirements/
	constexpr_data.cc: Add dg-require-cstdint directive.
	* testsuite/26_numerics/random/shuffle_order_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
	constexpr_data.cc: Likewise.
	* testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/operators/
	64351.cc: Likewise.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Likewise.
	* testsuite/experimental/algorithm/sample-2.cc: Likewise.
	* testsuite/experimental/algorithm/sample.cc: Likewise.
	* testsuite/experimental/algorithm/search.cc: Likewise.
	* testsuite/experimental/algorithm/shuffle.cc: Likewise.
	* testsuite/experimental/any/cons/aligned.cc: Likewise.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Likewise.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: Likewise.
	* testsuite/experimental/random/randint.cc: Likewise.
	* testsuite/experimental/source_location/1.cc: Likewise.
	* testsuite/ext/bitmap_allocator/overaligned.cc: Likewise.
	* testsuite/ext/malloc_allocator/overaligned.cc: Likewise.
	* testsuite/ext/mt_allocator/overaligned.cc: Likewise.
	* testsuite/ext/new_allocator/overaligned.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/priority_queue_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_set_rand.cc: Likewise.
	* testsuite/ext/pool_allocator/overaligned.cc: Likewise.
	* testsuite/ext/throw_allocator/check_allocate_max_size.cc: Likewise.
	* testsuite/ext/throw_allocator/check_deallocate_null.cc: Likewise.
	* testsuite/ext/throw_allocator/check_delete.cc: Likewise.
	* testsuite/ext/throw_allocator/check_new.cc: Likewise.
	* testsuite/ext/throw_allocator/deallocate_global.cc: Likewise.
	* testsuite/ext/throw_allocator/deallocate_local.cc: Likewise.
	* testsuite/ext/throw_allocator/explicit_instantiation.cc: Likewise.
	* testsuite/ext/throw_allocator/variadic_construct.cc: Likewise.
	* testsuite/tr1/8_c_compatibility/cinttypes/functions.cc: Likewise.

From-SVN: r263008
2018-07-26 15:03:28 +01:00
Jonathan Wakely 47114f2d02 Remove dg-require-cstdint directive from tests
Tests for components which are no longer dependent on
_GLIBCXX_USE_C99_STDINT_TR1 do not need to require <cstdint>.

	* testsuite/30_threads/recursive_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc:
	Likewise.
	* testsuite/30_threads/recursive_mutex/lock/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/native_handle/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc:
	Likewise.
	* testsuite/30_threads/recursive_mutex/requirements/standard_layout.cc:
	Likewise.
	* testsuite/30_threads/recursive_mutex/requirements/typedefs.cc:
	Likewise.
	* testsuite/30_threads/recursive_mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/unlock/2.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/dest/
	destructor_locked.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/lock/1.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/lock/2.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/native_handle/
	typesizes.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/requirements/typedefs.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/unlock/2.cc: Likewise.
	* testsuite/30_threads/scoped_lock/cons/1.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/assign.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/constexpr.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/copy.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/default.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/move.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/move_assign.cc: Likewise.
	* testsuite/30_threads/shared_future/members/45133.cc: Likewise.
	* testsuite/30_threads/shared_future/members/get.cc: Likewise.
	* testsuite/30_threads/shared_future/members/get2.cc: Likewise.
	* testsuite/30_threads/shared_future/members/valid.cc: Likewise.
	* testsuite/30_threads/shared_future/members/wait.cc: Likewise.
	* testsuite/30_threads/shared_future/members/wait_for.cc: Likewise.
	* testsuite/30_threads/shared_future/members/wait_until.cc: Likewise.
	* testsuite/30_threads/shared_future/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/1.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/2.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/3.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/4.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/5.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/6.cc: Likewise.
	* testsuite/30_threads/shared_lock/locking/1.cc: Likewise.
	* testsuite/30_threads/shared_lock/locking/2.cc: Likewise.
	* testsuite/30_threads/shared_lock/locking/3.cc: Likewise.
	* testsuite/30_threads/shared_lock/locking/4.cc: Likewise.
	* testsuite/30_threads/shared_lock/modifiers/1.cc: Likewise.
	* testsuite/30_threads/shared_lock/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/shared_lock/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/shared_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/shared_mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/shared_mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/shared_mutex/requirements/standard_layout.cc:
	Likewise.
	* testsuite/30_threads/shared_mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/shared_mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/shared_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/requirements/
	standard_layout.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/try_lock/3.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/this_thread/1.cc: Likewise.
	* testsuite/30_threads/this_thread/2.cc: Likewise.
	* testsuite/30_threads/this_thread/3.cc: Likewise.
	* testsuite/30_threads/this_thread/4.cc: Likewise.
	* testsuite/30_threads/this_thread/58038.cc: Likewise.
	* testsuite/30_threads/thread/70503.cc: Likewise.
	* testsuite/30_threads/thread/84532.cc: Likewise.
	* testsuite/30_threads/thread/adl.cc: Likewise.
	* testsuite/30_threads/thread/cons/1.cc: Likewise.
	* testsuite/30_threads/thread/cons/2.cc: Likewise.
	* testsuite/30_threads/thread/cons/3.cc: Likewise.
	* testsuite/30_threads/thread/cons/4.cc: Likewise.
	* testsuite/30_threads/thread/cons/49668.cc: Likewise.
	* testsuite/30_threads/thread/cons/5.cc: Likewise.
	* testsuite/30_threads/thread/cons/6.cc: Likewise.
	* testsuite/30_threads/thread/cons/7.cc: Likewise.
	* testsuite/30_threads/thread/cons/8.cc: Likewise.
	* testsuite/30_threads/thread/cons/84535.cc: Likewise.
	* testsuite/30_threads/thread/cons/9.cc: Likewise.
	* testsuite/30_threads/thread/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/thread/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/thread/cons/lwg2097.cc: Likewise.
	* testsuite/30_threads/thread/cons/moveable.cc: Likewise.
	* testsuite/30_threads/thread/cons/terminate.cc: Likewise.
	* testsuite/30_threads/thread/id/operators.cc: Likewise.
	* testsuite/30_threads/thread/members/1.cc: Likewise.
	* testsuite/30_threads/thread/members/2.cc: Likewise.
	* testsuite/30_threads/thread/members/3.cc: Likewise.
	* testsuite/30_threads/thread/members/4.cc: Likewise.
	* testsuite/30_threads/thread/members/5.cc: Likewise.
	* testsuite/30_threads/thread/members/hardware_concurrency.cc:
	Likewise.
	* testsuite/30_threads/thread/native_handle/cancel.cc: Likewise.
	* testsuite/30_threads/thread/swap/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/timed_mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/timed_mutex/dest/destructor_locked.cc: Likewise.
	* testsuite/30_threads/timed_mutex/lock/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/native_handle/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/native_handle/typesizes.cc:
	Likewise.
	* testsuite/30_threads/timed_mutex/requirements/
	standard_layout.cc: Likewise.
	* testsuite/30_threads/timed_mutex/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_for/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_for/2.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_for/3.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_until/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_until/2.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Likewise.
	* testsuite/30_threads/timed_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/unlock/2.cc: Likewise.
	* testsuite/30_threads/try_lock/1.cc: Likewise.
	* testsuite/30_threads/try_lock/2.cc: Likewise.
	* testsuite/30_threads/try_lock/3.cc: Likewise.
	* testsuite/30_threads/try_lock/4.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/1.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/2.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/3.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/4.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/5.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/6.cc: Likewise.
	* testsuite/30_threads/unique_lock/locking/1.cc: Likewise.
	* testsuite/30_threads/unique_lock/locking/2.cc: Likewise.
	* testsuite/30_threads/unique_lock/locking/3.cc: Likewise.
	* testsuite/30_threads/unique_lock/locking/4.cc: Likewise.
	* testsuite/30_threads/unique_lock/modifiers/1.cc: Likewise.
	* testsuite/30_threads/unique_lock/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/unique_lock/requirements/typedefs.cc: Likewise.

From-SVN: r263007
2018-07-26 15:03:01 +01:00
Jonathan Wakely c37f07c4d8 Remove dg-require-cstdint directive from tests
Tests for components which are no longer dependent on
_GLIBCXX_USE_C99_STDINT_TR1 do not need to require <cstdint>.

	* testsuite/30_threads/async/42819.cc: Remove dg-require-cstdint
	directive.
	* testsuite/30_threads/async/49668.cc: Likewise.
	* testsuite/30_threads/async/54297.cc: Likewise.
	* testsuite/30_threads/async/84532.cc: Likewise.
	* testsuite/30_threads/async/any.cc: Likewise.
	* testsuite/30_threads/async/async.cc: Likewise.
	* testsuite/30_threads/async/except.cc: Likewise.
	* testsuite/30_threads/async/forced_unwind.cc: Likewise.
	* testsuite/30_threads/async/launch.cc: Likewise.
	* testsuite/30_threads/async/lwg2021.cc: Likewise.
	* testsuite/30_threads/async/sync.cc: Likewise.
	* testsuite/30_threads/call_once/39909.cc: Likewise.
	* testsuite/30_threads/call_once/49668.cc: Likewise.
	* testsuite/30_threads/call_once/60497.cc: Likewise.
	* testsuite/30_threads/call_once/call_once1.cc: Likewise.
	* testsuite/30_threads/call_once/constexpr.cc: Likewise.
	* testsuite/30_threads/call_once/dr2442.cc: Likewise.
	* testsuite/30_threads/call_once/once_flag.cc: Likewise.
	* testsuite/30_threads/condition_variable/54185.cc: Likewise.
	* testsuite/30_threads/condition_variable/cons/1.cc: Likewise.
	* testsuite/30_threads/condition_variable/cons/assign_neg.cc:
	Likewise.
	* testsuite/30_threads/condition_variable/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/1.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/2.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/3.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/53841.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/68519.cc: Likewise.
	* testsuite/30_threads/condition_variable/native_handle/typesizes.cc:
	Likewise.
	* testsuite/30_threads/condition_variable/requirements/
	standard_layout.cc: Likewise.
	* testsuite/30_threads/condition_variable/requirements/typedefs.cc:
	* Likewise.
	* testsuite/30_threads/condition_variable_any/50862.cc: Likewise.
	* testsuite/30_threads/condition_variable_any/53830.cc: Likewise.
	* testsuite/30_threads/condition_variable_any/cons/1.cc: Likewise.
	* testsuite/30_threads/condition_variable_any/cons/assign_neg.cc:
	Likewise.
	* testsuite/30_threads/condition_variable_any/cons/copy_neg.cc:
	Likewise.
	* testsuite/30_threads/condition_variable_any/members/1.cc: Likewise.
	* testsuite/30_threads/condition_variable_any/members/2.cc: Likewise.
	* testsuite/30_threads/future/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/future/cons/constexpr.cc: Likewise.
	* testsuite/30_threads/future/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/future/cons/default.cc: Likewise.
	* testsuite/30_threads/future/cons/move.cc: Likewise.
	* testsuite/30_threads/future/cons/move_assign.cc: Likewise.
	* testsuite/30_threads/future/members/45133.cc: Likewise.
	* testsuite/30_threads/future/members/get.cc: Likewise.
	* testsuite/30_threads/future/members/get2.cc: Likewise.
	* testsuite/30_threads/future/members/share.cc: Likewise.
	* testsuite/30_threads/future/members/valid.cc: Likewise.
	* testsuite/30_threads/future/members/wait.cc: Likewise.
	* testsuite/30_threads/future/members/wait_for.cc: Likewise.
	* testsuite/30_threads/future/members/wait_until.cc: Likewise.
	* testsuite/30_threads/future/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/30_threads/headers/condition_variable/types_std_c++0x.cc:
	Likewise.
	* testsuite/30_threads/headers/future/types_std_c++0x.cc: Likewise.
	* testsuite/30_threads/headers/mutex/types_std_c++0x.cc: Likewise.
	* testsuite/30_threads/headers/thread/std_c++0x_neg.cc: Likewise.
	* testsuite/30_threads/headers/thread/types_std_c++0x.cc: Likewise.
	* testsuite/30_threads/lock/1.cc: Likewise.
	* testsuite/30_threads/lock/2.cc: Likewise.
	* testsuite/30_threads/lock/3.cc: Likewise.
	* testsuite/30_threads/lock/4.cc: Likewise.
	* testsuite/30_threads/lock_guard/cons/1.cc: Likewise.
	* testsuite/30_threads/lock_guard/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/lock_guard/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/mutex/cons/constexpr.cc: Likewise.
	* testsuite/30_threads/mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/mutex/dest/destructor_locked.cc: Likewise.
	* testsuite/30_threads/mutex/lock/1.cc: Likewise.
	* testsuite/30_threads/mutex/native_handle/1.cc: Likewise.
	* testsuite/30_threads/mutex/native_handle/typesizes.cc: Likewise.
	* testsuite/30_threads/mutex/requirements/standard_layout.cc::
	Likewise.
	* testsuite/30_threads/mutex/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/mutex/unlock/2.cc: Likewise.
	* testsuite/30_threads/once_flag/cons/constexpr.cc: Likewise.
	* testsuite/30_threads/packaged_task/49668.cc: Likewise.
	* testsuite/30_threads/packaged_task/60564.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/1.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/2.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/3.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/56492.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/alloc.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/alloc2.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/alloc_min.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/move.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/move_assign.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/at_thread_exit.cc:
	Likewise.
	* testsuite/30_threads/packaged_task/members/get_future.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/get_future2.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke2.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke3.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke4.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke5.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/reset.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/reset2.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/swap.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/valid.cc: Likewise.
	* testsuite/30_threads/packaged_task/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/packaged_task/uses_allocator.cc: Likewise.
	* testsuite/30_threads/promise/60966.cc: Likewise.
	* testsuite/30_threads/promise/69106.cc: Likewise.
	* testsuite/30_threads/promise/cons/1.cc: Likewise.
	* testsuite/30_threads/promise/cons/alloc.cc: Likewise.
	* testsuite/30_threads/promise/cons/alloc2.cc: Likewise.
	* testsuite/30_threads/promise/cons/alloc_min.cc: Likewise.
	* testsuite/30_threads/promise/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/promise/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/promise/cons/move.cc: Likewise.
	* testsuite/30_threads/promise/cons/move_assign.cc: Likewise.
	* testsuite/30_threads/promise/members/at_thread_exit.cc: Likewise.
	* testsuite/30_threads/promise/members/at_thread_exit2.cc: Likewise.
	* testsuite/30_threads/promise/members/get_future.cc: Likewise.
	* testsuite/30_threads/promise/members/get_future2.cc: Likewise.
	* testsuite/30_threads/promise/members/set_exception.cc: Likewise.
	* testsuite/30_threads/promise/members/set_exception2.cc: Likewise.
	* testsuite/30_threads/promise/members/set_value.cc: Likewise.
	* testsuite/30_threads/promise/members/set_value2.cc: Likewise.
	* testsuite/30_threads/promise/members/set_value3.cc: Likewise.
	* testsuite/30_threads/promise/members/swap.cc: Likewise.
	* testsuite/30_threads/promise/requirements/explicit_instantiation.cc:
	* Likewise.
	* testsuite/30_threads/promise/uses_allocator.cc: Likewise.

From-SVN: r263006
2018-07-26 15:02:42 +01:00
Jonathan Wakely 2b69e93cd1 Remove dg-require-cstdint directive from tests
Tests for components which are no longer dependent on
_GLIBCXX_USE_C99_STDINT_TR1 do not need to require <cstdint>.

	* testsuite/18_support/numeric_limits/char16_32_t.cc: Qualify names
	from namespace std.
	* testsuite/20_util/align/2.cc: Remove dg-require-cstdint directive.
	* testsuite/20_util/duration/arithmetic/1.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/2.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/dr2020.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/dr934-1.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/dr934-2.cc: Likewise.
	* testsuite/20_util/duration/comparison_operators/1.cc: Likewise.
	* testsuite/20_util/duration/cons/1.cc: Likewise.
	* testsuite/20_util/duration/cons/1_neg.cc: Likewise.
	* testsuite/20_util/duration/cons/2.cc: Likewise.
	* testsuite/20_util/duration/cons/54025.cc: Likewise.
	* testsuite/20_util/duration/cons/dr974_neg.cc: Likewise.
	* testsuite/20_util/duration/requirements/explicit_instantiation/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs-4.cc: Likewise.
	* testsuite/20_util/ratio/comparisons/comp1.cc: Likewise.
	* testsuite/20_util/ratio/comparisons/comp2.cc: Likewise.
	* testsuite/20_util/ratio/comparisons/comp3.cc: Likewise.
	* testsuite/20_util/ratio/cons/cons1.cc: Likewise.
	* testsuite/20_util/ratio/operations/45866.cc: Likewise.
	* testsuite/20_util/ratio/operations/47913.cc: Likewise.
	* testsuite/20_util/ratio/operations/53840.cc: Likewise.
	* testsuite/20_util/ratio/operations/ops1.cc: Likewise.
	* testsuite/20_util/shared_ptr/atomic/3.cc: Likewise.
	* testsuite/20_util/system_clock/1.cc: Likewise.
	* testsuite/20_util/time_point/1.cc: Likewise.
	* testsuite/20_util/time_point/2.cc: Likewise.
	* testsuite/20_util/time_point/3.cc: Likewise.
	* testsuite/20_util/time_point/requirements/explicit_instantiation/
	explicit_instantiation.cc: Likewise.
	* testsuite/21_strings/basic_string/requirements/
	explicit_instantiation/char16_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string/requirements/
	explicit_instantiation/char32_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/requirements/
	explicit_instantiation/char16_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/requirements/
	explicit_instantiation/char32_t/1.cc: Likewise.
	* testsuite/21_strings/char_traits/requirements/
	explicit_instantiation/char16_t/1.cc: Likewise.
	* testsuite/21_strings/char_traits/requirements/
	explicit_instantiation/char32_t/1.cc: Likewise.
	* testsuite/21_strings/headers/string/types_std_c++0x.cc: Likewise.
	* testsuite/22_locale/codecvt/char16_t.cc: Likewise.
	* testsuite/22_locale/codecvt/char32_t.cc: Likewise.
	* testsuite/22_locale/codecvt/codecvt_utf16/requirements/1.cc:
	Likewise.
	* testsuite/22_locale/codecvt/codecvt_utf8/requirements/1.cc:
	Likewise.
	* testsuite/22_locale/codecvt/codecvt_utf8_utf16/requirements/1.cc:
	Likewise.
	* testsuite/22_locale/codecvt/utf8.cc: Likewise.
	* testsuite/23_containers/vector/bool/72847.cc: Likewise.
	* testsuite/23_containers/vector/debug/multithreaded_swap.cc:
	Likewise.
	* testsuite/experimental/string_view/requirements/
	explicit_instantiation/char16_t/1.cc: Likewise.
	* testsuite/experimental/string_view/requirements/
	explicit_instantiation/char32_t/1.cc: Likewise.
	* testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/
	1.cc: Likewise.
	* testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/
	1.cc: Likewise.

From-SVN: r263005
2018-07-26 15:02:26 +01:00
Jonathan Wakely 8ba7f29e3d Remove <chrono> dependency on _GLIBCXX_USE_C99_STDINT_TR1
By adding fallback definitions of std::intmax_t and std::uintmax_t it's
possible to define <ratio> without _GLIBCXX_USE_C99_STDINT_TR1. This in
turn allows most of <chrono> to be defined, which removes the dependency
on _GLIBCXX_USE_C99_STDINT_TR1 for all of the C++11 concurrency features.

The compiler defines __INTMAX_TYPE__ and __UINTMAX_TYPE__
unconditionally so it should be safe to rely on them.

	* include/bits/atomic_futex.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(__atomic_futex_unsigned_base): Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1 macro.
	* include/bits/unique_lock.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(unique_lock): Remove dependency on _GLIBCXX_USE_C99_STDINT_TR1.
	* include/c_global/cstdint [!_GLIBCXX_USE_C99_STDINT_TR1] (intmax_t)
	(uintmax_t): Define using predefined macros.
	* include/std/chrono [!_GLIBCXX_USE_C99_STDINT_TR1] (duration)
	(time_point, system_clock, high_resolution_clock, steady_clock): Remove
	dependency on _GLIBCXX_USE_C99_STDINT_TR1 macro.
	(nanoseconds, microseconds, milliseconds, seconds, minutes, hours):
	[!_GLIBCXX_USE_C99_STDINT_TR1]: Define using __INT64_TYPE__ or
	long long when <stdint.h> is not usable.
	* include/std/condition_variable [!_GLIBCXX_USE_C99_STDINT_TR1]
	(condition_variable, condition_variable_any): Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1.
	* include/std/future [!_GLIBCXX_USE_C99_STDINT_TR1] (future, promise)
	(packaged_task, async): Likewise.
	* include/std/mutex [!_GLIBCXX_USE_C99_STDINT_TR1] (recursive_mutex)
	(timed_mutex, recursive_timed_mutex, try_lock, lock, scoped_lock)
	(once_flag, call_once): Likewise.
	* include/std/ratio [!_GLIBCXX_USE_C99_STDINT_TR1] (ratio): Likewise.
	* include/std/shared_mutex [!_GLIBCXX_USE_C99_STDINT_TR1]
	(shared_mutex, shared_timed_mutex, shared_lock): Likewise.
	* include/std/thread [!_GLIBCXX_USE_C99_STDINT_TR1] (thread)
	(this_thread::get_id, this_thread::yield, this_thread::sleep_for)
	(this_thread::sleep_until): Likewise.
	* src/c++11/chrono.cc: Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1 macro.
	* src/c++11/condition_variable.cc: Likewise.
	* src/c++11/futex.cc: Likewise.
	* src/c++11/future.cc: Likewise.
	* src/c++11/mutex.cc: Likewise.
	* src/c++11/thread.cc: Likewise.
	* testsuite/20_util/duration/literals/range_neg.cc: Adjust dg-error.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Likewise.
	* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.

From-SVN: r263001
2018-07-26 15:01:55 +01:00
Rainer Orth 864f020a10 xfail experimental/memory_resource/new_delete_resource.cc on 32-bit Solaris/x86 (PR libstdc++/77691)
PR libstdc++/77691
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	xfail execution on 32-bit Solaris/x86.

From-SVN: r263000
2018-07-26 12:36:21 +00:00
Jonathan Wakely aea3722348 PR libstdc++/86676 another alignment fix for test
PR libstdc++/86676
	* testsuite/20_util/monotonic_buffer_resource/release.cc: Request
	same alignment for post-release allocation.

From-SVN: r262984
2018-07-26 00:38:17 +01:00
Jonathan Wakely 17a6321210 PR libstdc++/86676 Do not assume stack buffer is aligned
PR libstdc++/86676
	* testsuite/20_util/monotonic_buffer_resource/release.cc: Allow for
	buffer being misaligned and so returned pointer not being at start.

From-SVN: r262980
2018-07-25 21:23:07 +01:00
Jonathan Wakely dfaa3c47cc Add initial version of C++17 <memory_resource> header
This is missing the synchronized_pool_resource and
unsynchronized_pool_resource classes but is otherwise complete.

This is a new implementation, not based on the existing code in
<experimental/memory_resource>, but memory_resource and
polymorphic_allocator ended up looking almost the same anyway.

The constant_init kluge in src/c++17/memory_resource.cc is apparently
due to Richard Smith and ensures that the objects are constructed during
constant initialiation phase and not destroyed (because the
constant_init destructor doesn't destroy the union member and the
storage is not reused).

	* config/abi/pre/gnu.ver: Export new symbols.
	* configure: Regenerate.
	* include/Makefile.am: Add new <memory_resource> header.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Include <memory_resource> for C++17.
	* include/std/memory_resource: New header.
	(memory_resource, polymorphic_allocator, new_delete_resource)
	(null_memory_resource, set_default_resource, get_default_resource)
	(pool_options, monotonic_buffer_resource): Define.
	* src/Makefile.am: Add c++17 directory.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.am: Fix comment.
	* src/c++17/Makefile.am: Add makefile for new sub-directory.
	* src/c++17/Makefile.in: Generate.
	* src/c++17/memory_resource.cc: New.
	(newdel_res_t, null_res_t, constant_init, newdel_res, null_res)
	(default_res, new_delete_resource, null_memory_resource)
	(set_default_resource, get_default_resource): Define.
	* testsuite/20_util/memory_resource/1.cc: New test.
	* testsuite/20_util/memory_resource/2.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/1.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/allocate.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/deallocate.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/release.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/upstream_resource.cc:
	New test.
	* testsuite/20_util/polymorphic_allocator/1.cc: New test.
	* testsuite/20_util/polymorphic_allocator/resource.cc: New test.
	* testsuite/20_util/polymorphic_allocator/select.cc: New test.
	* testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource):
	Define concrete memory resource for testing.
	(__gnu_test::default_resource_mgr): Define RAII helper for changing
	default resource.

From-SVN: r262953
2018-07-24 22:09:55 +01:00
Jonathan Wakely e874029dd9 PR libstdc++/86658 fix __niter_wrap to not copy invalid iterators
An output iterator passed as the unused first argument to __niter_wrap
might have already been invalidated, so don't copy it.

	PR libstdc++/86658
	* include/bits/stl_algobase.h (__niter_wrap<_Iterator>): Pass unused
	parameter by reference, to avoid copying invalid iterators.
	* testsuite/25_algorithms/copy/86658.cc: New test.

From-SVN: r262952
2018-07-24 21:49:10 +01:00
Jonathan Wakely 4f3c75ba3a Reorder conditions in uses-allocator construction helper
The erased_type condition is only true for code using the Library
Fundamentals TS, so assume it's less common and only check it after
checking for convertibility.

This does mean for types using erased_type the more expensive
convertibility check is done first, but such types are rare.

	* include/bits/uses_allocator.h (__is_erased_or_convertible): Reorder
	conditions. Add comments.
	* testsuite/20_util/uses_allocator/69293_neg.cc: Adjust dg-error line.
	* testsuite/20_util/uses_allocator/cons_neg.cc: Likewise.
	* testsuite/20_util/scoped_allocator/69293_neg.cc: Likewise.

From-SVN: r262945
2018-07-24 14:03:25 +01:00
Jonathan Wakely 2d6c8eea1d PR libstdc++/70940 optimize pmr::resource_adaptor for allocators using malloc
pmr::resource_adaptor can avoid allocating an oversized buffer and doing
manual alignment within that buffer when the wrapped allocator is known
to always meet the requested alignment. Specifically, if the allocator
is known to use malloc or new directly, then we can call the allocator
directly for any fundamental alignment.

	PR libstdc++/70940
	* include/experimental/memory_resource
	(__resource_adaptor_common::_AlignMgr::_M_unadjust): Add assertion.
	(__resource_adaptor_common::__guaranteed_alignment): New helper to
	give maximum alignment an allocator guarantees. Specialize for known
	allocators using new and malloc.
	(__resource_adaptor_imp::do_allocate): Use __guaranteed_alignment.
	(__resource_adaptor_imp::do_deallocate): Likewise.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Check that new and delete are called with expected sizes.

From-SVN: r262935
2018-07-23 20:40:28 +01:00
Jonathan Wakely c01f9216b7 Simplify the base characteristics for some type traits
* include/std/type_traits (__is_member_object_pointer_helper): Use
	__not_<is_function<_Tp>>::type instead of integral_constant.
	(__is_member_function_pointer_helper): Likewise for
	is_function<_Tp>::type.
	(is_compund): Likewise for __not_<is_fundamental<_Tp>>::type.
	(__do_is_nt_destructible_impl): Use __bool_constant and reindent.
	(is_trivially_constructible): Remove redundant use of
	is_constructible.
	(__is_trivially_copy_assignable_impl): Remove redundant use of
	is_copy_assignable.
	(__is_trivially_move_assignable_impl): Remove redundant use of
	is_move_assignable.
	(is_trivially_destructible): Use __bool_constant.
	* testsuite/20_util/is_trivially_assignable/value.cc: Add some more
	tests for scalar types.

From-SVN: r262889
2018-07-19 20:12:37 +01:00
Glen Joseph Fernandes 20a0c4e3dc Use __builtin_memmove for trivially copyable types
2018-07-19  Glen Joseph Fernandes  <glenjofe@gmail.com>

	* include/bits/stl_algobase.h (__copy_move_a): Used
	__is_trivially_copyable.
	(__copy_move_backward_a): Likewise.
	* testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc:
	New test.

From-SVN: r262884
2018-07-19 19:58:09 +01:00
Jonathan Wakely c3be340eb6 PR libstdc++/86450 use -Wabi=2 and simplify -Werror use
Use -Wabi=2 to fix warnings about -Wabi having no effect on its own.
This requires suppressing two warnings in src/c++11/debug.cc which do
not affect the library ABI.

Previously libstdc++ defaulted to --enable-werror but the -Werror flag
was not actually added unless --enable-maintainer-mode was used. This is
not documented and not the expected behaviour. This removes any special
treatment for maintainer-mode, makes -Werror depend directly on
--enable-werror, and changes the default to --enable-werror=no.

	PR libstdc++/86450
	* acinclude.m4 (GLIBCXX_CHECK_COMPILER_FEATURES): Don't define WERROR.
	(GLIBCXX_EXPORT_FLAGS): Use -Wabi=2 instead of -Wabi.
	* configure: Regenerate.
	* configure.ac: Change GLIBCXX_ENABLE_WERROR default to "no".
	* doc/Makefile.in: Regenerate.
	* fragment.am: Set WERROR_FLAG to -Werror instead of $(WERROR).
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/debug.cc: Use diagnostic pragmas to suppress warnings
	from -Wabi=2 that don't affect exported symbols.
	* src/c++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r262824
2018-07-17 14:18:47 +01:00
Jonathan Wakely 20b47be02c PR libstdc++/86537 remove less<shared_ptr<T>> partial specialization
The standard doesn't specify this partial specialization (it was
required after the changes in N2637 but then should have been removed
following LWG 1262). Its presence is observable because it causes
different results when operator< has been overloaded for a shared_ptr
specialization.

	PR libstdc++/86537
	* include/bits/shared_ptr.h (less<shared_ptr<_Tp>>): Remove
	non-standard partial specialization.
	* include/bits/shared_ptr_base.h (_Sp_less): Remove class definition.
	(less<__shared_ptr<_Tp, _Lp>): Remove partial specialization.
	* testsuite/20_util/shared_ptr/comparison/86537.cc: New test.

From-SVN: r262739
2018-07-16 18:13:41 +01:00
François Dumont 1e736a9531 functions.h (__gnu_debug::__check_string): Move...
2018-07-06  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/functions.h (__gnu_debug::__check_string): Move...
	* include/debug/string (__gnu_debug::__check_string): ... here.
	(_GLIBCXX_DEBUG_VERIFY_STR_COND_AT): New.
	(__glibcxx_check_string_n_constructor): New.
	(__gnu_debug::basic_string<>(const _CharT*, size_type, const _Alloc&)):
	Use latter.
	(__glibcxx_check_string_constructor): New.
	(__gnu_debug::basic_string<>(const _CharT*, const _Alloc&)):
	Use latter.
	* testsuite/21_strings/basic_string/debug/1_neg.cc: New.
	* testsuite/21_strings/basic_string/debug/2_neg.cc: New.

From-SVN: r262480
2018-07-06 17:02:33 +00:00
Jonathan Wakely 5840e3b8ff PR libstdc++/84928 use std::move in <numeric> algorithms
P0616R0 altered the effects of the <numeric> algorithms to use std::move
on the accumulator values (resolving LWG 2055). This implements the
change for C++2a, but retains the previous behaviour for older
standards.

	* include/bits/stl_numeric.h (_GLIBCXX_MOVE_IF_20): Define macro to
	conditionally move, according to __cplusplus value.
	(accumulate, inner_product, partial_sum, adjacent_difference): Use
	_GLIBCXX_MOVE_IF_20.
	* testsuite/26_numerics/accumulate/lwg2055.cc: New test.
	* testsuite/26_numerics/adjacent_difference/lwg2055.cc: New test.
	* testsuite/26_numerics/inner_product/lwg2055.cc: New test.
	* testsuite/26_numerics/partial_sum/lwg2055.cc: New test.

From-SVN: r262477
2018-07-06 15:16:13 +01:00
Jonathan Wakely 97271bd88f P0935R0 Eradicating unnecessarily explicit default constructors
This is the last remaining piece of P0935R0. This adds a default
constructor to each of the streambuf and stream types in <sstream> so
that default construction does not use the 'explicit' constructor that
has a single, defaulted argument.

	P0935R0 Eradicating unnecessarily explicit default constructors
	* config/abi/pre/gnu.ver: Tighten existing patterns and export new
	default constructor symbols.
	* include/std/sstream (basic_stringbuf, basic_istringstream)
	(basic_ostringstream, basic_stringstream): Remove default arguments
	from explicit constructors taking ios_base::openmode and add separate
	non-explicit default constructors.
	* testsuite/27_io/basic_istringstream/cons/default.cc: New.
	* testsuite/27_io/basic_ostringstream/cons/default.cc: New.
	* testsuite/27_io/basic_stringstream/cons/default.cc: New.
	* testsuite/27_io/basic_stringbuf/cons/char/default.cc: New.
	* testsuite/27_io/basic_stringbuf/cons/wchar_t/default.cc: New.

From-SVN: r262474
2018-07-06 13:39:02 +01:00
Jonathan Wakely d04dbb8ad3 PR libstdc++/85831 define move constructors and operators for exceptions
PR libstdc++/85831
	* config/abi/pre/gnu.ver: Export move constructors and move
	assignment operators for std::logic_error and std::runtime_error.
	* include/std/stdexcept: Use _GLIBCXX_NOTHROW instead of
	_GLIBCXX_USE_NOEXCEPT.
	(logic_error, runtime_error): Declare move constructors and move
	assignment operators. When not declared already, define copy
	constructors and copy assignment operators as explicit-defaulted.
	(domain_error, invalid_argument, length_error, out_of_range)
	(overflow_error, underflow_error): Define move constructors and move
	assignment operators as explicitly-defaulted.
	* libsupc++/exception.h (exception): Likewise.
	* src/c++11/cow-stdexcept.cc (logic_error, runtime_error): Define
	move constructors and move assignment operators as defaulted.
	* testsuite/19_diagnostics/stdexcept.cc: Check that constructors and
	assignment operators are defined.

From-SVN: r262456
2018-07-05 22:29:51 +01:00
Jonathan Wakely 339657d2d3 Add xfail-if to some tests that fail with COW strings
These tests fail when run with -D_GLIBCXX_USE_CXX11_ABI=0

	* testsuite/21_strings/basic_string/cons/char/deduction.cc: XFAIL for
	COW strings.
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/
	explicit_instantiation/debug.cc: Likewise.

From-SVN: r262448
2018-07-05 18:03:14 +01:00
Jonathan Wakely 30236791e0 PR libstdc++/58265 add noexcept to basic_string::assign(basic_string&&)
PR libstdc++/58265
	* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
	(basic_string::assign(basic_string&&)): Add conditional noexcept
	depending on the allocator's is_always_equal property (LWG 2063).
	* testsuite/21_strings/basic_string/modifiers/assign/char/
	move_assign.cc: Check for non-throwing exception specification.
	* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/
	move_assign.cc: Likewise.

From-SVN: r262447
2018-07-05 18:03:05 +01:00
Jonathan Wakely d8d9b83b33 PR libstdc++/58265 implement LWG 2063 for COW strings
For COW strings the default constructor does not allocate when
_GLIBCXX_FULLY_DYNAMIC_STRING == 0, so can be noexcept. The move
constructor and swap do not allocate when the allocators are equal, so
add conditional noexcept using allocator_traits::is_always_equal.

	PR libstdc++/58265
	* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
	[_GLIBCXX_FULLY_DYNAMIC_STRING==0] (basic_string::basic_string()):
	Add GLIBCXX_NOEXCEPT.
	(basic_string::operator=(basic_string&&)): Add _GLIBCXX_NOEXCEPT_IF
	to depend on the allocator's is_always_equal property (LWG 2063).
	(basic_string::swap(basic_string&)): Likewise.
	* include/bits/basic_string.tcc [!_GLIBCXX_USE_CXX11_ABI]
	(basic_string::swap(basic_string&)): Likewise.
	* testsuite/21_strings/basic_string/allocator/char/move_assign.cc:
	Check is_nothrow_move_assignable.
	* testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc:
	Check is_nothrow_move_assignable.
	* testsuite/21_strings/basic_string/cons/char/
	noexcept_move_construct.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/
	noexcept_move_construct.cc: Likewise.

From-SVN: r262443
2018-07-05 16:56:06 +01:00
Jonathan Wakely ef45724acd P0646R1 Improving the Return Value of Erase-Like Algorithms I
In C++2a the remove, remove_if and unique members of std::list and
std::forward_list have been changed to return the number of elements
removed. This is an ABI change for the remove members and the
non-template unique members, so an abi-tag is used to give those symbols
new mangled names in C++2a mode. For the function templates the return
type is part of the mangled name so no abi-tag is needed.

	* include/bits/forward_list.h (__cpp_lib_list_remove_return_type):
	Define.
	(forward_list::__remove_return_type): Define typedef as size_type or
	void, according to __cplusplus value.
	(_GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
	empty, according to __cplusplus value.
	(forward_list::remove, forward_list::unique): Use typedef and macro
	to change return type and add abi-tag for C++2a.
	(forward_list::remove_if<Pred>, forward_list::unique<BinPred>): Use
	typedef to change return type for C++2a.
	* include/bits/forward_list.tcc (_GLIBCXX20_ONLY): Define macro.
	(forward_list::remove, forward_list::remove_if<Pred>)
	(forward_list::unique<BinPred>): Return number of removed elements
	for C++2a.
	* include/bits/list.tcc (_GLIBCXX20_ONLY): Define macro.
	(list::remove, list::unique, list::remove_if<Predicate>)
	(list::unique<BinaryPredicate>): Return number of removed elements
	for C++2a.
	* include/bits/stl_list.h (__cpp_lib_list_remove_return_type): Define.
	(list::__remove_return_type): Define typedef as size_type or
	void, according to __cplusplus value.
	(_GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
	empty, according to __cplusplus value.
	(list::remove, list::unique): Use typedef and macro to change return
	type and add abi-tag for C++2a.
	(list::remove_if<Predicate>, list::unique<BinaryPredicate>): Use
	typedef to change return type for C++2a.
	* include/std/version (__cpp_lib_list_remove_return_type): Define.
	* testsuite/23_containers/forward_list/operations/
	remove_cxx20_return.cc: New.
	* testsuite/23_containers/forward_list/operations/
	unique_cxx20_return.cc: New.

From-SVN: r262423
2018-07-04 21:15:01 +01:00
Jonathan Wakely 3adea09eea P0458R2 Checking for Existence of an Element in Associative Containers
* include/bits/stl_map.h (map::contains): Add for C++2a.
	* include/bits/stl_multimap.h (multimap::contains): Likewise.
	* include/bits/stl_multiset.h (multiset::contains): Likewise.
	* include/bits/stl_set.h (set::contains): Likewise.
	* include/bits/stl_tree.h (__has_is_transparent_t): Define alias.
	(_Rb_tree::_M_find_tr, _Rb_tree::_M_count_tr)
	(_Rb_tree::_M_lower_bound_tr, _Rb_tree::_M_upper_bound_tr)
	(_Rb_tree::_M_equal_range_tr): Use __has_is_transparent_t.
	* include/bits/unordered_map.h (unordered_map::contains)
	(unordered_multimap::contains): Add for C++2a.
	* include/bits/unordered_set.h (unordered_set::contains)
	(unordered_multiset::contains): Likewise.
	* testsuite/23_containers/map/operations/contains.cc: New.
	* testsuite/23_containers/multimap/operations/contains.cc: New.
	* testsuite/23_containers/multiset/operations/contains.cc: New.
	* testsuite/23_containers/set/operations/contains.cc: New.
	* testsuite/23_containers/unordered_map/operations/contains.cc: New.
	* testsuite/23_containers/unordered_multimap/operations/contains.cc:
	New.
	* testsuite/23_containers/unordered_multiset/operations/contains.cc:
	New.
	* testsuite/23_containers/unordered_set/operations/contains.cc: New.

From-SVN: r262418
2018-07-04 19:16:26 +01:00
François Dumont 96eb9df619 re PR libstdc++/86272 (__gnu_debug::string uses undefined __glibcxx_check_insert_range2)
2018-07-04  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/86272
	* include/debug/string
	(__gnu_debug::basic_string<>::insert<_Ite>(const_iterator, _Ite, _Ite)):
	Use __glibcxx_check_insert_range.
	* 21_strings/basic_string/cons/char/1.cc: Adapt test to use
	__gnu_debug::string when _GLIBCXX_DEBUG.
	* 21_strings/basic_string/init-list.cc: Likewise.
	* 21_strings/basic_string/modifiers/insert/char/1.cc: Likewise.
	* 21_strings/basic_string/modifiers/insert/char/2.cc: Likewise.
	* 21_strings/basic_string/modifiers/insert/char/83328.cc: Likewise.
	* 21_strings/basic_string/types/1.cc: Likewise.

From-SVN: r262417
2018-07-04 18:13:11 +00:00
Jonathan Wakely 89bc4ab198 Define "random_device" effective target
Currently only matches targets where _GLIBCXX_USE_RANDOM_TR1 is defined,
which means /dev/random and /dev/urandom are usable.

	* testsuite/25_algorithms/make_heap/complexity.cc: Require effective
	target for std::random_device.
	* testsuite/26_numerics/random/random_device/cons/default.cc:
	Likewise.
	* testsuite/experimental/algorithm/sample-2.cc: Likewise.
	* testsuite/experimental/algorithm/shuffle.cc: Likewise.
	* testsuite/experimental/random/randint.cc: Likewise.
	* testsuite/lib/libstdc++.exp
	(check_effective_target_random_device): New proc.

From-SVN: r262415
2018-07-04 17:56:21 +01:00
Jonathan Wakely e9029d55f2 PR libstdc++/86398 fix std::is_trivially_constructible regression
The intrinsic doesn't check for allowed conversions between scalar
types, so restore the std::is_constructible check.

Also make some trivial whitespace changes.

	PR libstdc++/86398
	* include/std/type_traits (is_trivially_constructible): Check
	is_constructible before __is_trivially_constructible.
	* testsuite/20_util/is_trivially_constructible/value.cc: Add more
	tests, including negative cases.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Use
	zero for dg-error lineno.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.

From-SVN: r262379
2018-07-04 10:03:18 +01:00
Jonathan Wakely 90fc44ecfa Optimize std::rotl and std::rotr, add test for std::popcount
* include/std/bit (__rotl, __rotr): Avoid branch.
	(_If_is_unsigned_integer): Use remove_cv_t.
	* testsuite/26_numerics/bit/bitops.count/popcount.cc: New.

From-SVN: r262378
2018-07-04 09:07:23 +01:00
Jonathan Wakely f3e91052bd P0556R3 Integral power-of-2 operations, P0553R2 Bit operations
P0553R2 is not in the C++2a working draft yet, but is likely to be
approved soon. Neither proposal supports std::byte but this adds
overloads of each function for std::byte, assuming that will also get
added.

	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Include new header.
	* include/std/bit: New header.
	(__rotl, __rotr, __countl_zero, __countl_one, __countr_zero)
	(__countr_one, __popcount, __ispow2, __ceil2, __floor2, __log2p1):
	Define for C++14.
	[!__STRICT_ANSI__] (rotl, rotr, countl_zero, countl_one, countr_zero)
	(countr_one, popcount): Define for C++2a. Also overload for std::byte.
	(ispow2, ceil2, floor2, log2p1): Define for C++2a.
	[!__STRICT_ANSI__] (ispow2, ceil2, floor2, log2p1): Overload for
	std::byte.
	* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: New.
	* testsuite/26_numerics/bit/bit.pow.two/floor2.cc: New.
	* testsuite/26_numerics/bit/bit.pow.two/ispow2.cc: New.
	* testsuite/26_numerics/bit/bit.pow.two/log2p1.cc: New.
	* testsuite/26_numerics/bit/bitops.rot/rotl.cc: New.
	* testsuite/26_numerics/bit/bitops.rot/rotr.cc: New.
	* testsuite/26_numerics/bit/bitops.count/countl_one.cc: New.
	* testsuite/26_numerics/bit/bitops.count/countl_zero.cc: New.
	* testsuite/26_numerics/bit/bitops.count/countr_one.cc: New.
	* testsuite/26_numerics/bit/bitops.count/countr_zero.cc: New.

From-SVN: r262360
2018-07-03 22:04:45 +01:00
Jonathan Wakely 8df27fcb91 P0758R1 Implicit conversion traits
Extend __is_convertible_helper to also detect whether the conversion is
non-throwing, for std::is_nothrow_convertible in C++2a,

	* include/std/type_traits [__cplusplus > 201703]
	(__is_convertible_helper::__is_nothrow_type): Define new member.
	(__is_convertible_helper<_From, _To, false>::__test_aux1): Add
	noexcept.
	(__is_convertible_helper<_From, _To, false>::__test_nothrow)
	(__is_convertible_helper<_From, _To, false>::__is_nothrow_type): Add
	new members.
	(is_nothrow_convertible, is_nothrow_convertible_v): Define for C++2a.
	* testsuite/20_util/is_nothrow_convertible/value.cc: New.
	* testsuite/20_util/is_nothrow_convertible/requirements/
	explicit_instantiation.cc: New.
	* testsuite/20_util/is_nothrow_convertible/requirements/typedefs.cc:
	New.

From-SVN: r262322
2018-07-02 23:09:25 +01:00
Jonathan Wakely ee896276f6 P0887R1 The identity metafunction
* include/std/type_traits (type_identity, type_identity_t): Define
        for C++2a.
	* testsuite/20_util/type_identity/requirements/alias_decl.cc: New.
	* testsuite/20_util/type_identity/requirements/
	explicit_instantiation.cc:New.
	* testsuite/20_util/type_identity/requirements/typedefs.cc: New.

From-SVN: r262319
2018-07-02 22:05:08 +01:00
Jonathan Wakely e112d53aca Optimize std::sub_match comparisons using string_view-like type
Avoid creation of unnecessary basic_string objects by using a simplified
string_view type and performing comparisons on that type instead. A
temporary basic_string object is still used when the sub_match's
iterators are not contiguous, in order to get an object that the
__string_view can reference.

	* include/bits/regex.h (sub_match::operator string_type): Call str().
	(sub_match::compare): Use _M_str() instead of str().
	(sub_match::_M_compare): New public function.
	(sub_match::__string_view): New helper type.
	(sub_match::_M_str): New overloaded functions to avoid creating a
	string_type object when not needed.
	(operator==, operator!=, operator<, operator>, operator<=, operator>=):
	Use sub_match::_M_compare instead of creating string_type objects.
	Fix Doxygen comments.
	* include/bits/regex_compiler.h (__has_contiguous_iter): Remove.
	(__is_contiguous_normal_iter): Rename to __is_contiguous_iter and
	simplify.
	(__enable_if_contiguous_iter, __disable_if_contiguous_iter): Use
	__enable_if_t.
	* include/std/type_traits (__enable_if_t): Define for C++11.
	* testsuite/28_regex/sub_match/compare.cc: New.
	* testsuite/util/testsuite_iterators.h (remove_cv): Add transformation
	trait.
	(input_iterator_wrapper): Use remove_cv for value_type argument of
	std::iterator base class.

From-SVN: r262318
2018-07-02 21:31:11 +01:00
Jonathan Wakely 6fdce073fc Add whitespace to some dejagnu directives in libstdc++ tests
* testsuite/20_util/add_rvalue_reference/requirements/alias_decl.cc:
	Add whitespace to dejagnu directive.
	* testsuite/23_containers/array/element_access/at_neg.cc: Likewise.

From-SVN: r262245
2018-06-29 10:54:07 +01:00
François Dumont e6cad9872b stl_vector.h (struct _Vector_base<>::_Vector_impl_data): New.
2018-06-27  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_vector.h
	(struct _Vector_base<>::_Vector_impl_data): New.
	(struct _Vector_base<>::_Vector_impl): Inherit from latter.
	(_Vector_base<>::_Vector_impl::_M_swap_data): Move...
	(_Vector_base<>::_Vector_impl_data::_M_swap_data): ...here.
	(_Vector_base<>::_Vector_impl()): Add noexcept qualification.
	(_Vector_base<>::_Vector_impl(_Vector_impl&&)): New.
	(_Vector_base<>::_Vector_impl(_Tp_alloc_type&&, _Vector_impl&&)): New.
	(_Vector_base(const allocator_type&, _Vector_base&&)): New, use latter.
	(_Vector_base()): Default.
	(_Vector_base(_Vector_base&&)): Default.
	(_Vector_base(size_t)) [_GLIBCXX_INLINE_VERSION]: Delete.
	(_Vector_base(_Tp_alloc_type&&)) [_GLIBCXX_INLINE_VERSION]: Delete.
	(_Vector_base::_M_create_storage(size_t)): Make protected.
	(vector()): Default.
	(vector(vector&&)): Default.
	(vector(vector&&, const allocator_type&, true_type)): New.
	(vector(vector&&, const allocator_type&, false_type)): New.
	(vector(vector&&, const allocator_type&)): Use latters.
	(vector(_InputIte, _InputIte, const allocator_type&)): Call
	_M_range_initialize directly.
	* include/debug/vector
	(vector(vector&&, const allocator_type&)): Add noexcept qualification.
	* testsuite/23_containers/vector/allocator/default_init.cc: New.
	* testsuite/23_containers/vector/cons/noexcept_move_construct.cc: Add
	static assertions.

From-SVN: r262194
2018-06-27 20:23:20 +00:00
David Edelsohn 18338e9eee sample-2.cc: Add TLS DejaGNU directives.
* testsuite/experimental/algorithm/sample-2.cc: Add TLS DejaGNU
        directives.
        * testsuite/experimental/algorithm/shuffle.cc: Likewise.

From-SVN: r262163
2018-06-26 15:17:08 -04:00
Jonathan Wakely 3685dcd7fb PR libstdc++/86292 fix exception safety of std::vector<InputIterator> constructor
PR libstdc++/86292
	* include/bits/stl_vector.h (vector::_M_range_initialize<InputIter>):
	Add try-catch block.
	* testsuite/23_containers/vector/cons/86292.cc: New.

From-SVN: r262029
2018-06-25 17:46:33 +01:00
Jonathan Wakely 37cb7887f8 Add experimental::sample and experimental::shuffle from N4531
The additions to <experimental/random> were added in 2015 but the new
algorithms in <experimental/algorithm> were not. This adds them.

	* include/experimental/algorithm (sample, shuffle): Add new overloads
	using per-thread random number engine.
	* testsuite/experimental/algorithm/sample.cc: Simpify and reduce
	dependencies by using __gnu_test::test_container.
	* testsuite/experimental/algorithm/sample-2.cc: New.
	* testsuite/experimental/algorithm/shuffle.cc: New.

From-SVN: r262024
2018-06-25 17:23:49 +01:00
Jonathan Wakely d72888d340 PR libstdc++/86138 prevent implicit instantiation of COW empty rep
The explicit instantiation declarations for std::basic_string are
disabled for C++17 (and later) so that basic_string symbols get
implicitly instantiated in every translation unit that needs them.  On
targets that don't support STB_GNU_UNIQUE this leads to multiple copies
of the empty rep symbol for COW strings. In order to detect whether a
COW string needs to deallocate its storage it compares the address with
the empty rep.  When there are multiple copies of the empty rep object
the address is not unique, and so string destructors try to delete the
empty rep, which crashes.

In order to guarantee uniqueness of the _S_empty_rep_storage symbol this
patch adds an explicit instantiation declaration for just that symbol.
This means the other symbols are still implicitly instantiated in C++17
code, but for the empty rep the definition in the library gets used.

Separately, there is no need for C++17 code to implicitly instantiate
the I/O functions for strings, so this also restores the explicit
instantiation declarations for those functions.

	PR libstdc++/86138
	* include/bits/basic_string.tcc:
	[__cplusplus > 201402 && !_GLIBCXX_USE_CXX11_ABI]
	(basic_string<char>::_Rep::_S_empty_rep_storage)
	(basic_string<wchar_t>::_Rep::_S_empty_rep_storage): Add explicit
	instantiation declarations.
	[__cplusplus > 201402] (operator>>, operator<<, getline): Re-enable
	explicit instantiation declarations.
	* testsuite/21_strings/basic_string/cons/char/86138.cc: New.
	* testsuite/21_strings/basic_string/cons/wchar_t/86138.cc: New.

From-SVN: r261873
2018-06-22 00:29:01 +01:00
Jonathan Wakely cda121ac7a PR libstdc++/83328 add correct basic_string::insert for initializer_list
The SSO basic_string has a non-standard insert(iterator, initializer_list)
overload, from a C++0x draft. This adds the correct overload, while also
preserving the old one so that the old symbol is still exported from the
library.

The COW basic_string doesn't have any of the C++11 changes to the insert
overloads (they all still have non-const iterator parameters and the
ones that should return an iterator still return void). This doesn't
make any change to the COW string.

	PR libstdc++/83328
	* acinclude.m4 (libtool_VERSION): Bump to 6:26:0.
	* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.26 and export new symbol.
	* configure: Regenerate.
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::insert(const_iterator, initializer_list<C>)): Add.
	[_GLIBCXX_USE_CXX11_ABI && !_GLIBCXX_DEFINING_STRING_INSTANTIATIONS]
	(basic_string::insert(iterator, initializer_list<C>)): Suppress
	definition.
	* include/debug/string (basic_string::insert(iterator, C)): Change
	first parameter to const_iterator.
	(basic_string::insert(iterator, size_type, C)): Likewise. Change
	return type to iterator.
	(basic_string::insert(iterator, InputIterator, InputIterator)):
	Likewise.
	(basic_string::insert(iterator, initializer_list<C>)): Change first
	parameter to const_iterator and return type to iterator.
	* src/c++11/string-inst.cc: Extend comment.
	* testsuite/21_strings/basic_string/modifiers/insert/char/83328.cc:
	New.
	* testsuite/21_strings/basic_string/modifiers/insert/wchar_t/83328.cc:
	New.
	* testsuite/util/testsuite_abi.cc: Add new symbol version.

From-SVN: r261866
2018-06-21 23:01:25 +01:00
Jonathan Wakely e9df6a8f03 PR libstdc++/70940 make pmr::resource_adaptor return aligned memory
PR libstdc++/70940
	* include/experimental/memory_resource
	(__resource_adaptor_imp::do_deallocate): Add missing return.
	* testsuite/experimental/memory_resource/new_delete_resource.cc: New.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: Test
	resource_adaptor with std::allocator, __gnu_cxx::new_allocator and
	__gnu_cxx::malloc_allocator.

From-SVN: r261851
2018-06-21 17:24:00 +01:00
Jonathan Wakely 7956c508dd PR libstdc++/70940 make pmr::resource_adaptor return aligned memory
PR libstdc++/70940
	* include/experimental/memory_resource (__resource_adaptor_common):
	New base class.
	(__resource_adaptor_common::_AlignMgr): Helper for obtaining aligned
	pointer from unaligned, and vice versa.
	(__resource_adaptor_imp::do_allocate): Use _AlignMgr to adjust
	allocated pointer to meet alignment request.
	(__resource_adaptor_imp::do_deallocate): Use _AlignMgr to retrieve
	original pointer for deallocation.
	(__resource_adaptor_imp::do_is_equal): Reformat.
	(__resource_adaptor_imp::_S_aligned_size): Remove.
	(__resource_adaptor_imp::_S_supported): Remove.
	(new_delete_resource): Use __gnu_cxx::new_allocator.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: Test
	extended alignments and use debug_allocator to check for matching
	allocate/deallocate pairs.

From-SVN: r261849
2018-06-21 15:01:11 +01:00
Jonathan Wakely e70359b3de PR libstdc++/70966 make pmr::new_delete_resource() immortal
Construct the program-wide resource objects using placement new. This
means they have dynamic storage duration and won't be destroyed during
termination.

	PR libstdc++/70966
	* include/experimental/memory_resource (__resource_adaptor_imp): Add
	static assertions to enforce requirements on pointer types.
	(__resource_adaptor_imp::get_allocator()): Add noexcept.
	(new_delete_resource, null_memory_resource): Return address of an
	object with dynamic storage duration.
	(__null_memory_resource): Remove.
	* testsuite/experimental/memory_resource/70966.cc: New.

From-SVN: r261818
2018-06-20 20:34:53 +01:00
Jonathan Wakely d9addf3344 Add testcase accidentally not committed earlier
* testsuite/20_util/duration/arithmetic/dr3050.cc: Add new test
	missed from recent commit.

From-SVN: r261810
2018-06-20 16:54:57 +01:00
Jonathan Wakely 05891e9f45 LWG 2975 ensure construct(pair<T,U>*, ...) used to construct pairs
* include/std/scoped_allocator (__not_pair): Define SFINAE helper.
	(construct(_Tp*, _Args&&...)): Remove from overload set when _Tp is
	a specialization of std::pair.
	* testsuite/20_util/scoped_allocator/construct_pair.cc: Ensure
	pair elements are constructed correctly.

From-SVN: r261716
2018-06-18 21:17:44 +01:00
Jonathan Wakely b0874c667d LWG 2989 hide path iostream operators from normal lookup
By only defining these operators as friends (with no namespace-scope
declaration) they can only be found by ADL and do not participate in
overload resolution for arguments of types other than path.

	LWG 2989 hide path iostream operators from normal lookup
	* include/bits/fs_path.h (operator<<, operator>>): Define inline as
	friends.
	* testsuite/27_io/filesystem/path/io/dr2989.cc: New.

From-SVN: r261711
2018-06-18 19:59:44 +01:00
Jonathan Wakely 8499a82c19 LWG 3050 Fix cv-qualification of convertibility constraints
LWG 3050 Fix cv-qualification of convertibility constraints
	* include/std/chrono (duration, operator*, operator/, operator%): Use
	const-qualified type as source type in is_convertible constraints.
	* testsuite/20_util/duration/arithmetic/dr3050.cc: New.
	* testsuite/20_util/duration/cons/dr3050.cc: New.
	* testsuite/20_util/duration/literals/range.cc: Rename to...
	* testsuite/20_util/duration/literals/range_neg.cc: Here. Adjust
	dg-error lineno.

From-SVN: r261708
2018-06-18 19:02:24 +01:00
Jonathan Wakely 410fb7d7b0 P0754R2 <version> header
* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config: Change doxygen comment to suggest <version>
	instead of <iosfwd>.
	* include/precompiled/stdc++.h: Include <cwchar> and <cwctype>
	unconditionally.  Add C++17 and C++20 headers.
	* include/std/version: New header.
	* testsuite/17_intro/headers/c++2017/all_attributes.cc: New.
	* testsuite/17_intro/headers/c++2017/all_no_exceptions.cc: New.
	* testsuite/17_intro/headers/c++2017/all_no_rtti.cc: New.
	* testsuite/17_intro/headers/c++2017/all_pedantic_errors.cc: New.
	* testsuite/17_intro/headers/c++2017/operator_names.cc: New.
	* testsuite/17_intro/headers/c++2017/stdc++.cc: New.
	* testsuite/17_intro/headers/c++2017/stdc++_multiple_inclusion.cc:
	New.
	* testsuite/17_intro/headers/c++2020/all_attributes.cc: New.
	* testsuite/17_intro/headers/c++2020/all_no_exceptions.cc: New.
	* testsuite/17_intro/headers/c++2020/all_no_rtti.cc: New.
	* testsuite/17_intro/headers/c++2020/all_pedantic_errors.cc: New.
	* testsuite/17_intro/headers/c++2020/operator_names.cc: New.
	* testsuite/17_intro/headers/c++2020/stdc++.cc: New.
	* testsuite/17_intro/headers/c++2020/stdc++_multiple_inclusion.cc:
	New.
	* testsuite/18_support/headers/version/macros.cc: New.
	* testsuite/18_support/headers/version/macros.cc: New.

From-SVN: r261706
2018-06-18 17:42:11 +01:00
Jonathan Wakely 5d84e6c53e LWG 3076 basic_string CTAD ambiguity
When deduction guides are supported by the compiler (i.e. for C++17 and
later) replace two basic_string constructors by constrained function
templates as required by LWG 3075. In order to ensure that the pre-C++17
non-template constructors are still exported from the shared library
define a macro in src/c++11/string-inst.cc to force the non-template
declarations (this isn't strictly needed yet, because the string
instantiations are compiled with -std=gnu++11, but that is likely to
change).

	LWG 3076 basic_string CTAD ambiguity
	* doc/xml/manual/intro.xml: Document LWG 3076 change.
	* include/bits/basic_string.h
	[__cpp_deduction_guides && !_GLIBCXX_DEFINING_STRING_INSTANTIATIONS]
	(basic_string(const _CharT*, const _Alloc&)): Turn into a function
	template constrained by _RequireAllocator.
	(basic_string(size_type, _CharT, const _Alloc&)): Likewise.
	* src/c++11/string-inst.cc (_GLIBCXX_DEFINING_STRING_INSTANTIATIONS):
	Define.
	* testsuite/21_strings/basic_string/cons/char/deduction.cc: Test
	deduction
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
	Likewise.

From-SVN: r261670
2018-06-16 00:47:33 +01:00
Jonathan Wakely 525d67d42f PR libstdc++/86169 unshare COW string when non-const data() called
PR libstdc++/86169
	* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
	(basic_string::data()): Unshare string.
	* testsuite/21_strings/basic_string/operations/data/char/86169.cc:
	New.

From-SVN: r261642
2018-06-15 19:47:29 +01:00
Jonathan Wakely 36eec25a6f Decorate string_view members with nonnull attribute
The C++ committee has confirmed that passing a null pointer to the
unary basic_string_view constructor is undefined. This removes the check
from our implementation, and adds the nonnull attribute to warn when the
compiler can detect undefined input.

	* include/std/string_view (basic_string_view(const CharT*)): Remove
	check for null pointer and add nonnull attribute.
	(compare(const CharT*), compare(size_type, size_type, const CharT*))
	(find(const CharT*, size_type), rfind(const CharT*, size_type))
	(find_first_of(const CharT*, size_type))
	(find_last_of(const CharT*, size_type))
	(find_first_not_of(const CharT*, size_type))
	(find_last_not_of(const CharT*, size_type)): Add nonnull attribute.
	* testsuite/21_strings/basic_string_view/cons/char/nonnull.cc: New.
	* testsuite/21_strings/basic_string_view/operations/compare/char/
	nonnull.cc: New.
	* testsuite/21_strings/basic_string_view/operations/find/char/
	nonnull.cc: New.
	* testsuite/21_strings/basic_string_view/operations/rfind/char/
	nonnull.cc: New.

From-SVN: r261638
2018-06-15 17:47:55 +01:00
Jonathan Wakely 7f93abd805 LWG 2993 reference_wrapper<T> conversion from T&&
* doc/xml/manual/intro.xml: Document LWG 2993 change.
	* include/bits/refwrap.h (reference_wrapper(_Tp&)): Remove.
	(reference_wrapper(_Tp&&)): Remove.
	(reference_wrapper<_Up>(_Up&&)): Define new constructor as constrained
	template.
	(reference_wrapper): Add deduction guide.
	* testsuite/20_util/reference_wrapper/deduction.cc: New.
	* testsuite/20_util/reference_wrapper/lwg2993.cc: New.

From-SVN: r261632
2018-06-15 15:19:47 +01:00
Jonathan Wakely 53e926c8cd LWG 3075 basic_string needs deduction guides from basic_string_view
* testsuite/21_strings/basic_string/cons/char/deduction.cc: Test
	deduction from string views.
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
	Likewise.

From-SVN: r261612
2018-06-14 21:27:04 +01:00
Jonathan Wakely db5ab3aa92 LWG 3074 make scalar types non-deduced in valarray non-member functions
* include/bits/valarray_after.h (_DEFINE_EXPR_BINARY_FUNCTION): Change
	scalar parameters to be a non-deduced context.
	* include/std/valarray (_DEFINE_BINARY_OPERATOR): Likewise. Adjust
	whitespace.
	* testsuite/26_numerics/valarray/operators.cc: Test scalar operands.
	* testsuite/26_numerics/valarray/transcend.cc: New.

From-SVN: r261610
2018-06-14 20:36:54 +01:00
Jonathan Wakely e9ecac306b P0935R0 Eradicating unnecessarily explicit default constructors
More pieces of P0935R0, making default constructors non-explicit.

	* include/backward/strstream (strstreambuf): Add non-explicit default
	constructor.
	* include/bits/locale_conv.h (wbuffer_convert, wstring_convert):
	Likewise.
	* include/bits/regex.h (match_results): Likewise.
	* testsuite/22_locale/conversions/buffer/1.cc: Test for non-explicit
	default constructor.
	* testsuite/22_locale/conversions/string/1.cc: Likewise.
	* testsuite/28_regex/match_results/ctors/char/default.cc: Likewise.
	* testsuite/28_regex/match_results/ctors/wchar_t/default.cc: Likewise.

From-SVN: r261597
2018-06-14 15:12:24 +01:00
Jonathan Wakely 74755c6afc Define __cpp_lib_tuple_element_t in <tuple> not <utility>
* include/std/tuple (__cpp_lib_tuple_element_t): Move feature test
	macro from <utility> and change type to long.
	* include/std/utility (__cpp_lib_tuple_element_t): Remove.
	* testsuite/20_util/tuple/tuple_element_t.cc: Check for feature test
	macro.

From-SVN: r261596
2018-06-14 15:01:29 +01:00
Jonathan Wakely 977ac63eab P0935R0 Eradicating unnecessarily explicit default constructors
The param_type constructors of each random number distribution should
mirror the constructors of the distribution itself, so make the same
changes w.r.t explicit on default constructors.

	* include/bits/random.h (uniform_real_distribution::param_type)
	(normal_distribution::param_type, lognormal_distribution::param_type)
	(gamma_distribution::param_type, chi_squared_distribution::param_type)
	(cauchy_distribution::param_type, fisher_f_distribution::param_type)
	(student_t_distribution::param_type)
	(bernoulli_distribution::param_type)
	(binomial_distribution::param_type)
	(geometric_distribution::param_type)
	(negative_binomial_distribution::param_type)
	(poisson_distribution::param_type)
	(exponential_distribution::param_type)
	(weibull_distribution::param_type)
	(extreme_value_distribution::param_type): Add non-explicit default
	constructors. Remove default argument for first parameter of explicit
	constructors.
	* include/bits/uniform_int_dist.h
	(uniform_int_distribution::param_type): Likewise.
	* include/ext/random
	(beta_distribution::param_type, rice_distribution::param_type)
	(nakagami_distribution::param_type, pareto_distribution::param_type)
	(k_distribution::param_type, arcsine_distribution::param_type)
	(hoyt_distribution::param_type, triangular_distribution::param_type)
	(von_mises_distribution::param_type)
	(hypergeometric_distribution::param_type)
	(logistic_distribution::param_type)
	(uniform_inside_sphere_distribution::param_type): Likewise.
	(uniform_on_sphere_distribution::param_type): Make default constructor
	non-explicit.
	* testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc:
	Test param_type for non-explicit default constructor.
	* testsuite/26_numerics/random/binomial_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/cauchy_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/discrete_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/exponential_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/gamma_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/geometric_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/lognormal_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/normal_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/poisson_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/student_t_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/weibull_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/arcsine_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/beta_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/hoyt_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/hypergeometric_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/k_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/logistic_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/nakagami_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/normal_mv_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/pareto_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/rice_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/triangular_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/von_mises_distribution/cons/default.cc:
	Likewise.

From-SVN: r261592
2018-06-14 14:32:53 +01:00
Daniel Trebbien 4c1d999a7e PR libstdc++/83982 fix exception-safety guarantee of std::vector::resize
Construct new elements before moving existing ones, so that if a default
constructor throws, the existing elements are not left in a moved-from
state.

2018-06-14  Daniel Trebbien <dtrebbien@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/83982
	* include/bits/vector.tcc (vector::_M_default_append(size_type)):
	Default-construct new elements before moving existing ones.
	* testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc:
	New.

Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>

From-SVN: r261585
2018-06-14 10:26:51 +01:00
François Dumont eb04ee1d0f 2018-06-13 François Dumont <fdumont@gcc.gnu.org>
* include/debug/helper_functions.h
	(__gnu_debug::_Safe_iterator<>): Add declaration.
	(__can_advance(_Ite, _Size)): New.
	(__can_advance(const _Safe_iterator<>&, _Size)): Overload declaration.
	* include/debug/functions.h
	(__gnu_debug::_Safe_iterator<>): Remove declaration.
	* include/debug/stl_iterator.h
	(__can_advance(const _Safe_iterator<>&)): New definition.
	* include/debug/stl_iterator.h
	(__can_advance(const std::reverse_iterator<>&, _Size)): New.
	(__can_advance(const std::move_iterator<>&, _Size)): New.
	* include/debug/macros.h (__glibcxx_check_can_increment): New.
	* include/debug/debug.h (__glibcxx_requires_can_increment): New.
	* include/bits/stl_algobase.h (fill_n): Use latter.
	* testsuite/25_algorithms/fill_n/2.cc: New.
	* testsuite/25_algorithms/fill_n/debug/1_neg.cc: New.
	* testsuite/25_algorithms/fill_n/debug/2_neg.cc: New.
	* testsuite/25_algorithms/fill_n/debug/3_neg.cc: New.
	* testsuite/25_algorithms/fill_n/debug/4_neg.cc: New.

From-SVN: r261566
2018-06-13 20:27:26 +00:00
François Dumont 84a9d3b6c1 macros.h (__glibcxx_check_can_increment_range): New.
2018-06-12  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/macros.h (__glibcxx_check_can_increment_range): New.
	(__glibcxx_check_can_decrement_range): New.
	* include/debug/debug.h (__glibcxx_requires_can_increment_range): New.
	(__glibcxx_requires_can_decrement_range): New.
	* include/bits/stl_algobase.h (std::copy(_II, _II, _OI)): Use
	__glibcxx_requires_can_increment_range.
	(std::move(_II, _II, _OI)): Likewise.
	(std::copy_backward(_BI, _BI, _BI2)): Use
	__glibcxx_requires_can_decrement_range.
	(std::move_backward(_BI, _BI, _BI2)): Likewise.
	* testsuite/25_algorithms/copy_backward/debug/1_neg.cc: New.
	* testsuite/25_algorithms/copy_backward/debug/2_neg.cc: New.
	* testsuite/25_algorithms/copy_backward/debug/3_neg.cc: New.
	* testsuite/25_algorithms/equal/debug/1_neg.cc: New.
	* testsuite/25_algorithms/equal/debug/2_neg.cc: New.
	* testsuite/25_algorithms/equal/debug/3_neg.cc: New.

From-SVN: r261525
2018-06-12 20:18:35 +00:00
Jonathan Wakely dd9db6f897 P0935R0 Eradicating unnecessarily explicit default constructors
Explicit default constructors are problematic, so this change removes
them from <random> and <ext/random>, as per P0935R0.

	* include/bits/random.h (linear_congruential_engine)
	(mersenne_twister_engine, subtract_with_carry_engine, random_device)
	(uniform_real_distribution, normal_distribution)
	(lognormal_distribution, gamma_distribution, chi_squared_distribution)
	(cauchy_distribution, fisher_f_distribution, student_t_distribution)
	(bernoulli_distribution, binomial_distribution,geometric_distribution)
	(negative_binomial_distribution, exponential_distribution)
	(weibull_distribution, extreme_value_distribution): Add non-explicit
	default constructors. Remove default argument for first parameter of
	explicit constructors.
	(piecewise_constant_distribution, piecewise_linear_distribution):
	Make default constructor non-explicit.
	* include/bits/uniform_int_dist.h (uniform_int_distribution): Add
	non-explicit default constructors. Remove default argument for first
	parameter of explicit constructor.
	(simd_fast_mersenne_twister_engine, beta_distribution)
	(rice_distribution, nakagami_distribution, pareto_distribution)
	(k_distribution, arcsine_distribution, hoyt_distribution)
	(triangular_distribution, von_mises_distribution)
	(hypergeometric_distribution, logistic_distribution)
	(uniform_inside_sphere_distribution): Likewise.
	(uniform_on_sphere_distribution): Make default constructor
	non-explicit.
	* testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc:
	Test for non-explicit default constructor. Fix references to standard.
	* testsuite/26_numerics/random/binomial_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/cauchy_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/discrete_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/exponential_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/gamma_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/geometric_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/lognormal_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/normal_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/poisson_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/student_t_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/weibull_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/arcsine_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/beta_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/hoyt_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/hypergeometric_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/k_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/logistic_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/nakagami_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/normal_mv_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/pareto_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/rice_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/triangular_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/von_mises_distribution/cons/default.cc:
	Likewise.
	* testsuite/util/testsuite_common_types.h
	(implicitly_default_constructible): New helper.

From-SVN: r261522
2018-06-12 20:10:55 +01:00
Jonathan Wakely 7db54ccd8a PR libstdc++/86008 add std::quoted support for string_view
PR libstdc++/86008
	* include/bits/quoted_string.h (_Quoted_string<basic_string_view, C>):
	Define new partial specialization.
	* include/std/iomanip (quoted(basic_string_view<C,T>, C, C)): Define
	new overload.
	(operator<<(basic_ostream<C,T>&, const _Quoted_string<S,C>&)): Use
	value not reference for iteration.
	* testsuite/27_io/manipulators/standard/char/quoted.cc: Adjust
	comment.
	* testsuite/27_io/manipulators/standard/char/quoted_sv.cc: New test.
	* testsuite/27_io/manipulators/standard/wchar_t/quoted.cc: Adjust
	comment.

From-SVN: r261227
2018-06-06 07:05:07 +01:00
Jonathan Wakely ce6efef870 Mark some Filesystem tests as XFAIL for mingw
Symlinks are not supported on mingw.

	* testsuite/27_io/filesystem/operations/read_symlink.cc: XFAIL for
	mingw* targets.
	* testsuite/27_io/filesystem/operations/symlink_status.cc: Likewise.
	* testsuite/experimental/filesystem/operations/read_symlink.cc:
	Likewise.

From-SVN: r261185
2018-06-05 08:37:30 +01:00
Jonathan Wakely 9534a5e62d PR libstdc++/78870 support std::filesystem on Windows
PR libstdc++/78870 support std::filesystem on Windows
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for link, readlink and symlink.
	* include/bits/fs_path.h (path::operator/=(const path&)): Move
	definition out of class body.
	(path::is_absolute(), path::_M_append(path)): Likewise.
	(operator<<(basic_ostream, const path&)): Use std::quoted directly.
	(operator>>(basic_istream, path&)): Likewise.
	(u8path): Reorder definitions and fix Windows implementation.
	(path::is_absolute()): Define inline and fix for Windows.
	[!_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::operator/=(const path&)):
	Define POSIX version inline.
	(path::_M_append(path)): Define inline.
	* include/experimental/bits/fs_path.h (path::is_absolute()): Move
	definition out of class body.
	(operator<<(basic_ostream, const path&)): Fix type of delimiter and
	escape characters.
	(operator>>(basic_istream, path&)): Likewise.
	(path::is_absolute()): Define inline and fix for Windows.
	* src/filesystem/dir-common.h (__gnu_posix): New namespace.
	(__gnu_posix::char_type, __gnu_posix::DIR, __gnu_posix::dirent)
	(__gnu_posix::opendir, __gnu_posix::readdir, __gnu_posix::closedir):
	Define as adaptors for Windows functions/types or as
	using-declarations for POSIX functions/types.
	(_Dir_base, get_file_type): Qualify names to use declarations from
	__gnu_posix namespace.
	(_Dir_base::is_dor_or_dotdot): New helper functions.
	* src/filesystem/dir.cc (_Dir, recursive_directory_iterator): Qualify
	names to use declarations from __gnu_posix namespace.
	* src/filesystem/ops-common.h (__gnu_posix): New nested namespace.
	(__gnu_posix::open, __gnu_posix::close, __gnu_posix::stat_type)
	(__gnu_posix::stat, __gnu_posix::lstat, __gnu_posix::mode_t)
	(__gnu_posix::chmod, __gnu_posix::mkdir, __gnu_posix::getcwd)
	(__gnu_posix::chdir, __gnu_posix::utimbuf, __gnu_posix::utime)
	(__gnu_posix::rename, __gnu_posix::truncate, __gnu_posix::char_type):
	Define as adaptors for Windows functions/types or as
	using-declarations for POSIX functions/types.
	(stat_type, do_copy_file): Qualify names to use declarations from
	__gnu_posix namespace.
	(do_space): Declare new function.
	(make_file_type): Only use S_ISLNK if defined.
	* src/filesystem/ops.cc (char_ptr, filesystem::canonical): Use
	path::value_type not char.
	(filesystem::copy, create_dir, filesystem::create_directory): Qualify
	names to use declarations from __gnu_posix namespace.
	(filesystem::create_hard_link): Check HAVE_LINK autoconf macro and
	add implementation for Windows.
	(filesystem::create_symlink): Check HAVE_SYMLINK autoconf macro.
	(filesystem::current_path(error_code&)): Use __gnu_posix::getcwd.
	[!_PC_PATH_MAX]: Don't use pathconf.
	[PATH_MAX]: Use if defined.
	(filesystem::current_path(const path&, error_code&))
	(filesystem::equivalent, do_stat, filesystem::hard_link_count)
	(filesystem::last_write_time, filesystem::permissions): Use names
	from __gnu_posix.
	(filesystem::read_symlink): Check HAVE_READLINK autoconf macro.
	(filesystem::remove) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Add
	implementation for Windows.
	(filesystem::rename, filesystem::resize_file): Use names from
	__gnu_posix.
	(filesystem::space): Use do_space.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Get absolute path to directory.
	(filesystem::status, filesystem::symlink_status): Use names from
	__gnu_posix.
	(filesystem::temp_directory_path): Add implementation for Windows.
	* src/filesystem/path.cc (dot): Define constant.
	(path::replace_extension): Use dot.
	(path::_M_find_extension): Likewise. Use path::string_type not
	std::string.
	(path::_M_split_cmpts): Use dot.
	(filesystem_error::_M_get_what): Use u8string() not native().
	* src/filesystem/std-dir.cc (_Dir, recursive_directory_iterator):
	Qualify names to use declarations from __gnu_posix namespace.
	* src/filesystem/std-ops.cc (filesystem::absolute(const path&)): Use
	correct error_code.
	(filesystem::absolute(const path&, error_code&)): Add implementation
	for Windows.
	(char_ptr, filesystem::canonical): Use path::value_type not char.
	(do_copy_file): Use names from __gnu_posix.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Do not use fchmod, fchmodat or
	sendfile.
	(filesystem::copy, create_dir, filesystem::create_directory): Qualify
	names to use declarations from __gnu_posix namespace.
	(filesystem::create_hard_link): Check HAVE_LINK autoconf macro and
	add implementation for Windows.
	(filesystem::create_symlink): Check HAVE_SYMLINK autoconf macro.
	(filesystem::current_path(error_code&)): Use __gnu_posix::getcwd.
	[!_PC_PATH_MAX]: Don't use pathconf.
	[PATH_MAX]: Use if defined.
	(filesystem::current_path(const path&, error_code&))
	(filesystem::equivalent, do_stat, filesystem::hard_link_count)
	(filesystem::last_write_time, filesystem::permissions): Use names
	from __gnu_posix.
	(filesystem::read_symlink): Check HAVE_READLINK autoconf macro.
	(filesystem::remove) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Add
	implementation for Windows.
	(filesystem::rename, filesystem::resize_file): Use names from
	__gnu_posix.
	(do_space): Define.
	(filesystem::space): Use do_space.
	(filesystem::status, filesystem::symlink_status): Use names from
	__gnu_posix.
	(filesystem::temp_directory_path): Add implementation for Windows.
	* src/filesystem/std-path.cc
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::operator/=(const path&)):
	Define for Windows.
	(dot): Define constant.
	(path::replace_extension, is_dot): Use dot.
	(path::lexically_normal): Check _M_type instead of calling
	non-existent function.
	(path::_M_find_extension): Use dot. Use path::string_type not
	std::string.
	(path::_M_split_cmpts): Use dot.
	(filesystem_error::_M_get_what): Use u8string() not native().
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc: Do not
	use symlinks.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/absolute.cc: Use
	__gnu_test::root_path() instead of "/" and add Windows-specific tests.
	* testsuite/27_io/filesystem/operations/canonical.cc: Use
	path::string() to get narrow string, not path::native().
	* testsuite/27_io/filesystem/operations/copy.cc: Construct fstreams
	with std::filesystem::path not std::basic_string.
	* testsuite/27_io/filesystem/operations/copy_file.cc: Likewise.
	* testsuite/27_io/filesystem/operations/exists.cc: Use
	__gnu_test::root_path() instead of "/".
	* testsuite/27_io/filesystem/operations/is_empty.cc: Construct
	fstreams with std::filesystem::path not std::basic_string.
	* testsuite/27_io/filesystem/operations/last_write_time.cc: Use
	path::string() to get narrow string.
	* testsuite/27_io/filesystem/operations/space.cc: Check results for
	errors, expect sensible values otherwise.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc: Add
	helpers for adjusting the environment on Windows.
	* testsuite/27_io/filesystem/path/append/path.cc: Test
	Windows-specific behaviour.
	* testsuite/27_io/filesystem/path/construct/format.cc: Fix creation
	of path::string_type objects.
	* testsuite/27_io/filesystem/path/construct/locale.cc: Compare native
	string to wide string on Windows.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc: Allow
	for backslash as root-directory.
	* testsuite/27_io/filesystem/path/decompose/stem.cc: Use
	path::string() to get narrow string.
	* testsuite/27_io/filesystem/path/itr/traversal.cc: Test Windows-style
	paths.
	* testsuite/27_io/filesystem/path/native/string.cc: Use string_type
	not std::string.
	* testsuite/27_io/filesystem/path/query/is_absolute.cc: Adjust for
	different definintion of absolute paths on Windows.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Do not use symlinks.
	* testsuite/experimental/filesystem/operations/absolute.cc: Test
	Windows behaviour.
	* testsuite/experimental/filesystem/operations/copy.cc: Construct
	fstreams with NTCTS not std::basic_string.
	* testsuite/experimental/filesystem/operations/copy_file.cc: Likewise.
	* testsuite/experimental/filesystem/operations/exists.cc: Use
	__gnu_test::root_path() instead of "/".
	* testsuite/experimental/filesystem/operations/is_empty.cc: Construct
	fstreams with NTCTS not std::basic_string.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Use path::string() to get narrow string.
	* testsuite/experimental/filesystem/operations/space.cc: Use
	__gnu_test::root_path() instead of "/".
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Add helpers for adjusting the environment on Windows.
	* testsuite/experimental/filesystem/path/append/path.cc: Use
	path::string() to get narrow strings for comparisons.
	* testsuite/experimental/filesystem/path/concat/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/native/string.cc: Use
	string_type not std::string.
	* testsuite/experimental/filesystem/path/query/is_absolute.cc:
	Adjust for different definintion of absolute paths on Windows.
	* testsuite/util/testsuite_fs.h (__gnu_test::root_path()): New
	function.
	(__gnu_test::scoped_file): Construct fstreams with NTCTS not
	std::basic_string.

From-SVN: r261034
2018-05-31 20:20:24 +01:00
Jonathan Wakely 22f1f4c790 PR libstdc++/85951 for make_signed/make_unsigned for character types
Because the wide character types are neither signed integer types nor
unsigned integer types they need to be transformed to an integral type
of the correct size and the lowest rank (which is not necessarily the
underlying type). Reuse the helpers for enumeration types to select the
correct integer.

The refactoring of __make_unsigned_selector and __make_signed_selector
slightly reduces the number of template instantiations and so reduces
memory usage.

	PR libstdc++/85951
	* include/std/type_traits [_GLIBCXX_USE_C99_STDINT_TR1]: Do not define
	uint_least16_t and uint_least32_t.
	(__make_unsigned<wchar_t>): Define unconditionally.
	(__make_unsigned_selector<_Tp, true, false>): Remove intermediate
	typedefs.
	(__make_unsigned_selector_base): New type to provide helper templates.
	(__make_unsigned_selector<_Tp, false, true>): Reimplement using
	__make_unsigned_selector_base helpers.
	(__make_unsigned<char16_t>, __make_unsigned<char32_t>): Define.
	(__make_signed_selector<_Tp, true, false>): Remove intermediate
	typedefs.
	(__make_signed<wchar_t>, __make_signed<char16_t>)
	(__make_signed<char32_t>)): Define unconditionally.
	* testsuite/20_util/make_signed/requirements/typedefs-3.cc: Check
	wchar_t, char16_t and char32_t are transformed correctly.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
	dg-error lineno.
	* testsuite/20_util/make_unsigned/requirements/typedefs-3.cc: Check
	wchar_t, char16_t and char32_t are transformed correctly.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust
	dg-error lineno.

From-SVN: r261023
2018-05-31 13:18:19 +01:00
Jason Merrill 04eb9c5574 PR c++/67445 - returning temporary initializer_list.
PR c++/67711 - assigning from temporary initializer_list.
	PR c++/48562 - new initializer_list.
	* typeck.c (maybe_warn_about_returning_address_of_local): Also warn
	about returning local initializer_list.
	* cp-tree.h (AUTO_TEMP_NAME, TEMP_NAME_P): Remove.
	* call.c (build_over_call): Warn about assignment from temporary
	init_list.
	* init.c (build_new_1): Warn about 'new std::initializer_list'.
	(find_list_begin, maybe_warn_list_ctor): New.
	(perform_member_init): Use maybe_warn_list_ctor.

From-SVN: r260905
2018-05-29 16:04:52 -04:00
Jonathan Wakely 25999a112f Implement P0558R2 changes to std::atomic
The restrictions forbidding arithmetic on atomic pointer types are only
enabled for C++17 and later, retaining the GNU extension for older
standards. The new nested typedefs and changes to prevent scalar
parameters participating in template argument deduction are enabled
unconditionally.

	PR libstdc++/69769
	PR libstdc++/85886
	* include/bits/atomic_base.h (__atomic_base::value_type)
	(__atomic_base::difference_type): Add new typedefs.
	* include/std/atomic (atomic<bool>::value_type, atomic<T>::value_type)
	(atomic<T*>::value_type, atomic<T*>::difference_type): Likewise.
	(atomic<T*>::operator++, atomic<T*>::operator--)
	(atomic<T*>::operator+=, atomic<T*>::operator-=)
	(atomic<T*>::fetch_add, atomic<T*>::fetch_sub): Add static assertion
	to enforce C++17 requirement on pointer arithmetic.
	(__atomic_val_t, __atomic_diff_t): New alias templates.
	(atomic_init, atomic_store_explicit, atomic_exchange_explicit)
	(atomic_compare_exchange_weak_explicit)
	(atomic_compare_exchange_strong_explicit, atomic_store)
	(atomic_exchange, atomic_compare_exchange_weak)
	(atomic_compare_exchange_strong): Use __atomic_val_t to make
	scalar parameters be non-deduced contexts.
	(atomic_fetch_add_explicit, atomic_fetch_sub_explicit)
	(atomic_fetch_add, atomic_fetch_sub): Change first parameter to be
	atomic instead of __atomic_base, and use __atomic_diff_t for scalar
	parameters.
	(atomic_fetch_and_explicit, atomic_fetch_or_explicit)
	(atomic_fetch_xor_explicit, atomic_fetch_and, atomic_fetch_or)
	(atomic_fetch_xor): Use __atomic_val_t for scalar parameters.
	(atomic_fetch_add_explicit, atomic_fetch_sub_explicit)
	(atomic_fetch_add, atomic_fetch_sub): Remove overloads for atomic
	address types.
	* testsuite/29_atomics/atomic/60695.cc: Adjust dg-error lineno.
	* testsuite/29_atomics/atomic/69769.cc: New test.
	* testsuite/29_atomics/atomic/nonmembers.cc: New test.
	* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
	Disable test for C++17 and later.
	* testsuite/29_atomics/atomic/requirements/typedefs.cc: New test.
	* testsuite/29_atomics/atomic_integral/nonmembers.cc: New test.
	* testsuite/29_atomics/atomic_integral/requirements/typedefs.cc: New
	test.

From-SVN: r260676
2018-05-24 16:28:26 +01:00
Jonathan Wakely 49d729eaee Refactor path construction from null terminated iterator ranges
Move duplicated code to new _S_string_from_iter function and fix
constraints to accept iterators with const value type.

	* include/bits/fs_path.h (path::__is_encoded_char): Change from class
	template to alias template.
	(path::__value_type_is_char): Use remove_const_t.
	(path:_S_string_from_iter): New helper function.
	(path::_S_convert(InputIter, __null_terminated))
	(path::_S_convert_loc(InputIter, __null_terminated, const locale&)):
	Use _S_string_from_iter.
	(path::string<_CharT, _Allocator>(const _Allocator&)): Allow sharing
	rep for COW strings.
	* include/experimental/bits/fs_path.h (path::__is_encoded_char):
	Change from class template to alias template.
	(path::__value_type_is_char): Use remove_const.
	(path:_S_string_from_iter): New helper function.
	(path::_S_convert(InputIter, __null_terminated))
	(path::_S_convert_loc(InputIter, __null_terminated, const locale&)):
	Use _S_string_from_iter.
	* testsuite/27_io/filesystem/path/append/source.cc: Test appending
	wide strings.
	* testsuite/27_io/filesystem/path/concat/strings.cc: Check for exact
	string equality, not path equivalence.
	* testsuite/27_io/filesystem/path/construct/format.cc: Check
	construction from std::string and std::wstring and input iterators.
	* testsuite/27_io/filesystem/path/construct/locale.cc: Check
	construction from iterators.
	* testsuite/experimental/filesystem/path/concat/strings.cc: Check for
	exact string equality, not path equivalence.
	* testsuite/experimental/filesystem/path/construct/locale.cc: Check
	construction from iterators.

From-SVN: r260628
2018-05-23 23:48:51 +01:00
Jonathan Wakely cf290ea325 Fix handling of an empty filename at end of a path
The C++17 std::filesystem::path grammar allows an empty filename as the
last component (to signify a trailing slash). The existing code does not
handle this consistently, sometimes an empty filename has type _Multi
and sometimes it has type _Filename. This can result in a non-empty
iterator range for an empty filename component.

This change ensures that empty paths always have type _Filename and will
yield an empty iterator range.

	* include/bits/fs_path.h (path::_M_type): Change default member
	initializer to _Filename.
	(path::begin): Create past-the-end iterator for empty path.
	* src/filesystem/std-path.cc (path::remove_filename()): Remove
	debugging check.
	(path::has_relative_path()): Return false for empty filenames.
	(path::_M_split_cmpts): Set _M_type to _Filename for empty paths.
	Fix offset of empty final component.
	* testsuite/27_io/filesystem/path/itr/components.cc: New.
	* testsuite/27_io/filesystem/path/itr/traversal.cc: Add new inputs.

From-SVN: r260616
2018-05-23 17:11:06 +01:00
Jonathan Wakely b02923592a Add support for opening file streams from wide character strings
C++17 added new overloads to <fstream> class templates to support
opening files from wide character strings "on systems where
filesystem::path::value_type is not char". This patch adds those
overloads conditional on _wfopen being available, and enables them for
pre-C++17 modes as well.

	Add support for opening file streams from wide character strings.
	* config/io/basic_file_stdio.cc [_GLIBCXX_HAVE__WFOPEN]
	(__basic_file<char>::open(const wchar_t*, ios_base::openmode)):
	Define new overload.
	* config/io/basic_file_stdio.h [_GLIBCXX_HAVE__WFOPEN]
	(__basic_file<char>::open(const wchar_t*, ios_base::openmode)):
	Declare new overload.
	* configure.ac: Check for _wfopen.
	* crossconfig.m4: Likewise.
	* configure: Regenerate.
	* config.h.in: Regenerate.
	* include/bits/fstream.tcc [_GLIBCXX_HAVE__WFOPEN]
	(basic_filebuf<C,T>::open(const wchar_t*, ios_base::openmode)):
	Define new overload.
	* include/std/fstream [_GLIBCXX_HAVE__WFOPEN]
	(basic_filebuf<C,T>::open(const wchar_t*, ios_base::openmode)):
	Declare new overload.
	[_GLIBCXX_HAVE__WFOPEN]
	(basic_ifstream<C,T>::basic_ifstream(const wchar_t*, openmode))
	(basic_ifstream<C,T>::basic_open(const wchar_t*, openmode))
	(basic_ofstream<C,T>::basic_ifstream(const wchar_t*, openmode))
	(basic_ofstream<C,T>::basic_open(const wchar_t*, openmode))
	(basic_fstream<C,T>::basic_ifstream(const wchar_t*, openmode))
	(basic_fstream<C,T>::basic_open(const wchar_t*, openmode)): Define
	new overloads.
	* testsuite/27_io/basic_filebuf/open/wchar_t/1.cc: New.
	* testsuite/27_io/basic_ifstream/cons/wchar_t/1.cc: New.
	* testsuite/27_io/basic_ifstream/open/wchar_t/1.cc: New.
	* testsuite/27_io/basic_ofstream/cons/wchar_t/1.cc: New.
	* testsuite/27_io/basic_ofstream/open/wchar_t/1.cc: New.
	* testsuite/27_io/basic_fstream/cons/wchar_t/1.cc: New.
	* testsuite/27_io/basic_fstream/open/wchar_t/1.cc: New.

From-SVN: r260479
2018-05-21 18:18:35 +01:00
Jonathan Wakely 8a49324e8a Fix std::filesystem::absolute for empty paths
* src/filesystem/std-ops.cc (absolute): Report an error for empty
	paths.
	(weakly_canonical(const path&)): Do not call canonical on empty path.
	(weakly_canonical(const path&, error_code&)): Likewise.
	* testsuite/27_io/filesystem/operations/absolute.cc: Check for errors.

From-SVN: r260441
2018-05-21 13:52:44 +01:00
Jonathan Wakely cc343938cb PR libstdc++/85818 make new test require Filesystem support
PR libstdc++/85818
	* testsuite/experimental/filesystem/path/preferred_separator.cc: Add
	dg-require-filesystem-ts.

From-SVN: r260439
2018-05-21 13:27:00 +01:00
Jonathan Wakely a76400f4e6 Fix std::codecvt_utf8<wchar_t> for Mingw
* src/c++11/codecvt.cc (__codecvt_utf8_base<wchar_t>::do_in)
	[__SIZEOF_WCHAR_T__==2 && __BYTE_ORDER__!=__ORDER_BIG_ENDIAN__]: Set
	little_endian element in bitmask.
	* testsuite/22_locale/codecvt/codecvt_utf8/69703.cc: Run all tests.
	* testsuite/22_locale/codecvt/codecvt_utf8/wchar_t/1.cc: New.

From-SVN: r260389
2018-05-19 03:03:42 +01:00
François Dumont 8b0cd47a1c 2018-05-18 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tree.h
	(_Rb_tree_impl(_Rb_tree_impl&&, _Node_allocator&&)): New.
	(_Rb_tree(_Rb_tree&&, _Node_allocator&&, true_type)): New, use latter.
	(_Rb_tree(_Rb_tree&&, _Node_allocator&&, false_type)): New.
	(_Rb_tree(_Rb_tree&&, _Node_allocator&&)): Adapt, use latters.
	* include/debug/map.h
	(map(map&&, const_allocator_type&)): Add noexcept qualitication.
	* include/debug/multimap.h
	(multimap(multimap&&, const_allocator_type&)): Likewise.
	* include/debug/set.h
	(set(set&&, const_allocator_type&)): Likewise.
	* include/debug/multiset.h
	(multiset(multiset&&, const_allocator_type&)): Likewise.
	* testsuite/23_containers/map/cons/noexcept_default_construct.cc:
	Add checks.
	* testsuite/23_containers/map/cons/noexcept_move_construct.cc:
	Add checks.
	* testsuite/23_containers/multimap/cons/noexcept_default_construct.cc:
	Add checks.
	* testsuite/23_containers/multimap/cons/noexcept_move_construct.cc:
	Add checks.
	* testsuite/23_containers/multiset/cons/noexcept_default_construct.cc:
	Add checks.
	* testsuite/23_containers/multiset/cons/noexcept_move_construct.cc:
	Add checks.
	* testsuite/23_containers/set/cons/noexcept_default_construct.cc:
	Add checks.
	* testsuite/23_containers/set/cons/noexcept_move_construct.cc:
	Add checks.

From-SVN: r260382
2018-05-18 20:49:49 +00:00
Jonathan Wakely 2d76fab440 PR libstdc++/85098 add missing definitions for static constants
In C++11 and C++14 any odr-use of these constants requires a definition
at namespace-scope.  In C++17 they are implicitly inline and so the
namespace-scope redeclarations are redundant (and allowing them is
deprecated).

	PR libstdc++/85098
	* include/bits/regex.h [__cplusplus < 201703L] (basic_regex::icase)
	(basic_regex::nosubs, basic_regex::optimize, basic_regex::collate)
	(basic_regex::ECMAScript, basic_regex::basic, basic_regex::extended)
	(basic_regex::awk, basic_regex::grep, basic_regex::egrep): Add
	definitions.
	* include/bits/regex_automaton.h (_NFA::_M_insert_state): Adjust
	whitespace.
	* include/bits/regex_compiler.tcc (__INSERT_REGEX_MATCHER): Add
	braces around body of do-while.
	* testsuite/28_regex/basic_regex/85098.cc: New

From-SVN: r260371
2018-05-18 17:14:04 +01:00
Jonathan Wakely 079638f924 PR libstdc++/85818 ensure path::preferred_separator is defined
Because path.cc is compiled with -std=gnu++17 the static constexpr
data member is implicitly 'inline' and so no definition gets emitted
unless it gets used in that translation unit. Other translation units
built as C++11 or C++14 still require a namespace-scope definition of
the variable, so mark the definition as used.

	PR libstdc++/85818
	* src/filesystem/path.cc (path::preferred_separator): Add used
	attribute.
	* testsuite/experimental/filesystem/path/preferred_separator.cc: New.

From-SVN: r260326
2018-05-17 16:36:25 +01:00
Jonathan Wakely 5a7960da41 PR libstdc++/85749 constrain seed sequences for random number engines
Constrain constructors and member functions of random number engines so
that functions taking seed sequences can only be called with types that
meet the seed sequence requirements.

	PR libstdc++/85749
	* include/bits/random.h (__detail::__is_seed_seq): New SFINAE helper.
	(linear_congruential_engine, mersenne_twister_engine)
	(subtract_with_carry_engine, discard_block_engine)
	(independent_bits_engine, shuffle_order_engine): Use __is_seed_seq to
	constrain function templates taking seed sequences.
	* include/bits/random.tcc (linear_congruential_engine::seed(_Sseq&))
	(mersenne_twister_engine::seed(_Sseq&))
	(subtract_with_carry_engine::seed(_Sseq&)): Change return types to
	match declarations.
	* include/ext/random (simd_fast_mersenne_twister_engine): Use
	__is_seed_seq to constrain function templates taking seed sequences.
	* include/ext/random.tcc (simd_fast_mersenne_twister_engine::seed):
	Change return type to match declaration.
	* testsuite/26_numerics/random/discard_block_engine/cons/seed_seq2.cc:
	New.
	* testsuite/26_numerics/random/independent_bits_engine/cons/
	seed_seq2.cc: New.
	* testsuite/26_numerics/random/linear_congruential_engine/cons/
	seed_seq2.cc: New.
	* testsuite/26_numerics/random/mersenne_twister_engine/cons/
	seed_seq2.cc: New.
	* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
	* testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq2.cc:
	New.
	* testsuite/26_numerics/random/subtract_with_carry_engine/cons/
	seed_seq2.cc: New.
	* testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/
	seed_seq2.cc: New.

From-SVN: r260263
2018-05-15 16:36:46 +01:00
Jonathan Wakely c3b61fdadd PR libstdc++/83891 fix path::is_absolute() for non-POSIX targets
The correct definition seems to be has_root_directory() for all systems
we care about.

	PR libstdc++/83891
	* include/bits/fs_path.h (path::is_absolute()): Use same definition
	for all operating systems.
	* include/experimental/bits/fs_path.h (path::is_absolute()): Likewise.
	* testsuite/27_io/filesystem/path/query/is_absolute.cc: New.
	* testsuite/27_io/filesystem/path/query/is_relative.cc: Fix comment.
	* testsuite/experimental/filesystem/path/query/is_absolute.cc: New.

From-SVN: r260259
2018-05-15 14:50:49 +01:00
Jonathan Wakely b0e0168246 Remove unused headers from tests
* testsuite/27_io/filesystem/path/decompose/extension.cc: Remove
	unused <vector> header.
	* testsuite/27_io/filesystem/path/query/empty.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_extension.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_filename.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_parent_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_relative_path.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/query/has_root_directory.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/query/has_root_name.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_root_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_stem.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/is_relative.cc: Likewise.
	* testsuite/experimental/filesystem/path/decompose/extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/empty.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/has_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_name.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/is_relative.cc:
	Likewise.

From-SVN: r260256
2018-05-15 13:43:44 +01:00
Jonathan Wakely 6cda876da2 PR libstdc++/84159 fix appending strings to paths
The path::operator/=(const Source&) and path::append overloads were
still following the semantics of the Filesystem TS not C++17. Only
the path::operator/=(const path&) overload was correct.

This change adds more tests for path::operator/=(const path&) and adds
new tests to verify that the other append operations have equivalent
behaviour.

	PR libstdc++/84159
	* include/bits/fs_path.h (path::operator/=, path::append): Construct
	temporary path before calling _M_append.
	(path::_M_append): Change parameter to path and implement C++17
	semantics.
	* testsuite/27_io/filesystem/path/append/path.cc: Add helper function
	and more examples from the standard.
	* testsuite/27_io/filesystem/path/append/source.cc: New.
	* testsuite/27_io/filesystem/path/decompose/filename.cc: Add comment.
	* testsuite/27_io/filesystem/path/nonmember/append.cc: New.

From-SVN: r260255
2018-05-15 13:07:09 +01:00
Jonathan Wakely e77497ab77 PR libstdc++/81256 fix exception handling in basic_filebuf::close
PR libstdc++/81256
	* include/bits/fstream.tcc (basic_filebuf::close): Do not swallow
	exceptions from _M_terminate_output().
	* include/std/fstream (basic_filebuf::~basic_filebuf): Swallow any
	exceptions from close().
	* testsuite/27_io/basic_filebuf/close/81256.cc: New.

From-SVN: r260236
2018-05-14 19:57:45 +01:00
Jonathan Wakely 3846b8e4b3 PR libstdc++/82966 fix swapping of node handles
PR libstdc++/82966
	* include/bits/node_handle.h (_Node_handle_common::_M_swap): Use value
	instead of type.
	* testsuite/23_containers/set/modifiers/node_swap.cc: New.

From-SVN: r260226
2018-05-14 15:27:54 +01:00
Ville Voutilainen 456dbc7275 re PR libstdc++/80165 (Constexpr tuple of variant doesn't work)
PR libstdc++/80165
* testsuite/20_util/variant/80165.cc: New.

From-SVN: r260209
2018-05-13 13:36:12 +03:00
Edward Smith-Rowland b5f52fb14f ...and actually resture the *new* testcase.
From-SVN: r260172
2018-05-11 17:38:26 +00:00
Edward Smith-Rowland 841c9597da Restore the testcase that was clobbered by the recent PR83140 patches.
* libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions
	/02_assoc_legendre/check_value.cc

From-SVN: r260168
2018-05-11 16:58:46 +00:00
Edward Smith-Rowland 88bf4c34e3 PR libstdc++/83140 - assoc_legendre returns negated value when m is odd
2018-05-10  Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/83140 - assoc_legendre returns negated value when m is odd
	* include/tr1/legendre_function.tcc (__assoc_legendre_p): Add __phase
	argument defaulted to +1.  Doxy comments on same.
	* testsuite/special_functions/02_assoc_legendre/
	check_assoc_legendre.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	02_assoc_legendre/check_tr1_assoc_legendre.cc: Regen.

From-SVN: r260115
2018-05-10 13:59:52 +00:00
François Dumont 6c882d0fdc safe_iterator.h (_Safe_iterator<>::_M_constant()): Rename in...
2018-05-09  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/safe_iterator.h (_Safe_iterator<>::_M_constant()):
	Rename in...
	(_Safe_iterator<>::_S_constant()): ...that.
	* include/debug/safe_local_iterator.h
	(_Safe_local_iterator<>::_M_constant()): Rename in...
	(_Safe_local_iterator<>::_S_constant()): ...that.
	* include/debug/formatter.h: Remove bits/cpp_type_traits.h include.
	(_Iterator_state::__rbegin): New.
	(_Iterator_state::__rmiddle): New.
	(_Iterator_state::__rend): New.
	(_Parameter::_Parameter(const _Safe_iterator<>&, const char*,
	_Is_iterator)): Use _Safe_iterator<>::_S_constant. Grab normal underlying
	iterator type.
	(_Parameter::_Parameter(const _Safe_local_iterator<>&, const char*,
	_Is_iterator)): Likewise.
	(_Parameter::_S_reverse_state(_Iterator_state)): New.
        (_Parameter(__gnu_cxx::__normal_iterator<> const&, const char*,
	_Is_iterator)): New.
	(_Parameter(std::reverse_iterator<> const&, const char*,
	_Is_iterator)): New.
	(_Parameter(std::reverse_iterator<_Safe_iterator<>> const&,
	const char*, _Is_iterator)): New.
	(_Parameter(std::move_iterator<> const&, const char*, _Is_iterator):
	New.
	(_Parameter(std::move_iterator<_Safe_iterator<>> const&, const char*,
	_Is_iterator)): New.
	* testsuite/24_iterators/move_iterator/debug_neg.cc: New.
	* testsuite/24_iterators/normal_iterator/debug_neg.cc: New.
	* testsuite/24_iterators/reverse_iterator/debug_neg.cc: New.

From-SVN: r260093
2018-05-09 20:04:46 +00:00
Jonathan Wakely 88b1e41c2d Make std::function tolerate semantically non-CopyConstructible objects
To satisfy the CopyConstructible requirement a callable object stored in
a std::function must behave the same when copied from a const or
non-const source. If copying a non-const object doesn't produce an
equivalent copy then the behaviour is undefined. But we can make our
std::function more tolerant of such objects by ensuring we always copy
from a const lvalue.

Additionally use an if constexpr statement in the _M_get_pointer
function to avoid unnecessary instantiations in the discarded branch.

	* include/bits/std_function.h (_Base_manager::_M_get_pointer):
	Use constexpr if in C++17 mode.
	(_Base_manager::_M_clone(_Any_data&, const _Any_data&, true_type)):
	Copy from const object.
	* testsuite/20_util/function/cons/non_copyconstructible.cc: New.

From-SVN: r260080
2018-05-09 14:28:11 +01:00
Edward Smith-Rowland eda0ab6ec6 Rollback bad commits! Sorry!
From-SVN: r260003
2018-05-07 16:13:48 +00:00
Edward Smith-Rowland b118dfdb6d Revert 20001.
From-SVN: r260002
2018-05-07 16:02:46 +00:00
Edward Smith-Rowland c69c7d0381 Moar PR libstdc++/80506
2018-05-07  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Moar PR libstdc++/80506
	* include/bits/random.tcc (gamma_distribution::__generate_impl()):
	Fix magic number used in loop condition.

From-SVN: r260001
2018-05-07 15:55:11 +00:00
Jonathan Wakely d6ed6b074f PR libstdc++/85642 fix is_nothrow_default_constructible<optional<T>>
Add missing noexcept keyword to default constructor of each
_Optional_payload specialization.

	PR libstdc++/85642 fix is_nothrow_default_constructible<optional<T>>
	* include/std/optional (_Optional_payload): Add noexcept to default
	constructor. Re-indent.
	(_Optional_payload<_Tp, true, true, true>): Likewise. Add noexcept to
	constructor for copying disengaged payloads.
	(_Optional_payload<_Tp, true, false, true>): Likewise.
	(_Optional_payload<_Tp, true, true, false>): Likewise.
	(_Optional_payload<_Tp, true, false, false>): Likewise.
	* testsuite/20_util/optional/cons/85642.cc: New.
	* testsuite/20_util/optional/cons/value_neg.cc: Adjust dg-error lines.

From-SVN: r259928
2018-05-04 09:57:23 +01:00
Jonathan Wakely 86f66562b7 PR libstdc++/82644 define TR1 hypergeometric functions in strict modes
Following a recent change for PR 82644 the non-standard hypergeomtric
functions are not defined by <cmath> when __STRICT_ANSI__ is defined
(e.g. for -std=c++17, or -std=c++14 -D__STDCPP_WANT_MATH_SPEC_FUNCS__).
That caused errors in <tr1/cmath> because the using-declarations for
tr1::hyperg et al are invalid in strict modes.

The solution is to define the TR1 hypergeometric functions inline in
<tr1/cmath> if __STRICT_ANSI__ is defined.

	PR libstdc++/82644
	* include/tr1/cmath [__STRICT_ANSI__] (hypergf, hypergl, hyperg): Use
	inline definitions instead of using-declarations.
	[__STRICT_ANSI__] (conf_hypergf, conf_hypergl, conf_hyperg): Likewise.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	07_conf_hyperg/compile_cxx17.cc: New.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	17_hyperg/compile_cxx17.cc: New.

From-SVN: r259912
2018-05-03 23:58:43 +01:00
Jonathan Wakely 2e023647c8 PR libstdc++/85632 fix wraparound in filesystem::space
On 32-bit targets any values over 4GB would wrap and produce the wrong
result.

	PR libstdc++/85632 use uintmax_t for arithmetic
	* src/filesystem/ops.cc (experimental::filesystem::space): Perform
	arithmetic in result type.
	* src/filesystem/std-ops.cc (filesystem::space): Likewise.
	* testsuite/27_io/filesystem/operations/space.cc: Check total capacity
	is greater than free space.
	* testsuite/experimental/filesystem/operations/space.cc: New.

From-SVN: r259901
2018-05-03 19:58:00 +01:00
Jonathan Wakely adba76a391 Add tests for std::remove_cvref
* testsuite/20_util/remove_cvref/requirements/alias_decl.cc: New.
	* testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc:
	New.
	* testsuite/20_util/remove_cvref/value.cc: New.
	* testsuite/20_util/remove_cvref/value_ext.cc: New.

From-SVN: r259896
2018-05-03 16:12:19 +01:00
Jonathan Wakely 852ee53c27 PR libstdc++/84087 add default arguments to basic_string members (LWG 2268)
This change was a DR against C++11 and so should have been implemented
years ago.

	PR libstdc++/84087 LWG DR 2268 basic_string default arguments
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI=1]
	(append(const basic_string&, size_type, size_type)
	(assign(const basic_string&, size_type, size_type)
	(insert(size_type, const basic_string&, size_type, size_type)
	(replace(size_type,size_type,const basic_string&,size_type,size_type)
	(compare(size_type,size_type,constbasic_string&,size_type,size_type)):
	Add default arguments (LWG 2268).
	[_GLIBCXX_USE_CXX11_ABI=0]
	(append(const basic_string&, size_type, size_type)
	(assign(const basic_string&, size_type, size_type)
	(insert(size_type, const basic_string&, size_type, size_type)
	(replace(size_type,size_type,const basic_string&,size_type,size_type)
	(compare(size_type,size_type,constbasic_string&,size_type,size_type)):
	Likewise.
	* testsuite/21_strings/basic_string/dr2268.cc: New test.

From-SVN: r259895
2018-05-03 16:01:20 +01:00
Jonathan Wakely d49b342694 PR libstdc++/84535 constrain std::thread constructor
The standard requires that the std::thread constructor is constrained so
it can't be called with a first argument of type std::thread. The
current implementation only meets that requirement if the constructor is
called with one argument, by using deleted overloads. This uses an
enable_if constraint to enforce the requirement for any number of
arguments.

Also add a static assertion to give a more readable error for invalid
arguments that cannot be invoked. Also simplify _Invoker to reduce the
error cascade for ill-formed instantiations with non-invocable
arguments.

	PR libstdc++/84535
	* include/std/thread (thread::__not_same): New SFINAE helper.
	(thread::thread(_Callable&&, _Args&&...)): Add SFINAE constraint that
	first argument is not a std::thread. Add static assertion to check
	INVOKE expression is valid.
	(thread::thread(thread&), thread::thread(const thread&&)): Remove.
	(thread::_Invoke::_M_invoke, thread::_Invoke::operator()): Use
	__invoke_result for return types and remove exception specifications.
	* testsuite/30_threads/thread/cons/84535.cc: New.

From-SVN: r259893
2018-05-03 15:08:36 +01:00
François Dumont 27db01d803 deque.tcc (deque<>::_M_assign_aux): Cast to void to ensure overloaded comma not used.
2018-05-02  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/deque.tcc (deque<>::_M_assign_aux): Cast to void to
	ensure overloaded comma not used.
	* include/bits/list.tcc (list<>::_M_assign_dispatch): Likewise.
	* include/bits/vector.tcc (vector<>::_M_assign_aux): Likewise.
	* include/bits/stl_bvector.h (vector<bool>::_M_assign_aux): Likewise.
	* testsuite/23_containers/deque/modifiers/assign/1.cc: New.
	* testsuite/23_containers/list/modifiers/assign/1.cc: New.
	* testsuite/23_containers/vector/bool/modifiers/assign/1.cc: New.
	* testsuite/23_containers/vector/modifiers/assign/1.cc: New.

From-SVN: r259856
2018-05-02 19:51:33 +00:00
Jonathan Wakely 85d0fad469 PR libstdc++/68197 fail on negative iword/pword indices
The suggested resolution of LWG 3083 is to make invalid indices
undefined, but we can fairly easily check for them and treat them as
errors in the same way as allocation failure. This avoids a segfault or
worse, setting an error flag on the stream instead.

	PR libstdc++/68197
	* include/bits/ios_base.h (ios_base::iword, ios_base::pword): Cast
	indices to unsigned.
	* src/c++11/ios.cc (ios_base::_M_grow_words): Treat negative indices
	as failure. Refactor error handling.
	* testsuite/27_io/ios_base/storage/68197.cc: New.

From-SVN: r259854
2018-05-02 20:04:55 +01:00
Jonathan Wakely 1b749ae95e PR libstdc++/83860 avoid dangling references in valarray closure types
Store nested closures by value not by reference, to prevent holding
invalid references to temporaries that have been destroyed. This
changes the layout of the closure types, so change their linkage names,
but moving them to a different namespace.

	PR libstdc++/57997
	PR libstdc++/83860
	* include/bits/gslice_array.h (gslice_array): Define default
	constructor as deleted, as per C++11 standard.
	* include/bits/mask_array.h (mask_array): Likewise.
	* include/bits/slice_array.h (slice_array): Likewise.
	* include/bits/valarray_after.h (_GBase, _GClos, _IBase, _IClos): Move
	to namespace __detail.
	(_GBase::_M_expr, _IBase::_M_expr): Use _ValArrayRef for type of data
	members.
	* include/bits/valarray_before.h (_ValArrayRef): New helper for type
	of data members in closure objects.
	(_FunBase, _ValFunClos, _RefFunClos, _UnBase, _UnClos, _BinBase)
	(_BinBase2, _BinBase1, _BinClos, _SBase, _SClos): Move to namespace
	__detail.
	(_FunBase::_M_expr, _UnBase::_M_expr, _BinBase::_M_expr1)
	(_BinBase::_M_expr2, _BinBase2::_M_expr1, _BinBase1::_M_expr2)
	(_SBase::_M_expr): Use _ValArrayRef for type of data members.
	* include/std/valarray (_UnClos, _BinClos, _SClos, _GClos, _IClos)
	(_ValFunClos, _RefFunClos): Move to namespace __detail and add
	using-declarations to namespace std.
	* testsuite/26_numerics/valarray/83860.cc: New.

From-SVN: r259844
2018-05-02 17:41:46 +01:00
Jonathan Wakely 59bcf90013 Remove duplicate function call in test
* testsuite/backward/strstream_move.cc: Remove duplicate function
	call.

From-SVN: r259843
2018-05-02 17:27:01 +01:00
Jonathan Wakely c6d4257972 PR libstdc++/69608 Move semantics for strstreambuf
In libstdc++ the deprecated char* streams are non-copyable, as was
required pre-C++11.

Since C++11 the standard implies that those streams should be copyable,
but doesn't specify the effects of copying them. This is surely a
defect, so for consistency with other implementations this change makes
them movable, but not copyable.

	PR libstdc++/69608
	* include/backward/strstream (strstreambuf): Define move constructor
	and move assignment operator.
	(istrstream, ostrstream, strstream): Likewise.
	* testsuite/backward/strstream_move.cc: New.

From-SVN: r259842
2018-05-02 17:25:44 +01:00
Jonathan Wakely 8cc8789fb4 PR libstdc++/84442 if _Exit isn't declared then use _exit instead
PR libstdc++/84442
	* testsuite/30_threads/thread/cons/terminate.cc
	[!_GLIBCXX_USE_C99_STDLIB] : Use _exit or std::exit instead of _Exit.

From-SVN: r259463
2018-04-18 12:15:38 +01:00
Jonathan Wakely ef0e80d23c Make Filesystem TS tests pass in C++17 mode
The <testsuite_fs.h> header defaults to using std::filesystem in C++17
mode. The Filesystem TS tests need to define the macro that causes
std::experimental::filesystem to be used instead.

	* testsuite/experimental/filesystem/file_status/1.cc: Add
	-DUSE_FILESYSTEM_TS to dg-options.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Likewise.
	* testsuite/experimental/filesystem/iterators/pop.cc: Likewise.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.
	* testsuite/experimental/filesystem/operations/absolute.cc: Likewise.
	* testsuite/experimental/filesystem/operations/canonical.cc: Likewise.
	* testsuite/experimental/filesystem/operations/copy.cc: Likewise.
	* testsuite/experimental/filesystem/operations/copy_file.cc: Likewise.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/create_symlink.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/current_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/equivalent.cc: Likewise.
	* testsuite/experimental/filesystem/operations/exists.cc: Likewise.
	* testsuite/experimental/filesystem/operations/file_size.cc: Likewise.
	* testsuite/experimental/filesystem/operations/is_empty.cc: Likewise.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/permissions.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/read_symlink.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/remove.cc: Likewise.
	* testsuite/experimental/filesystem/operations/remove_all.cc: Likewise.
	* testsuite/experimental/filesystem/operations/status.cc: Likewise.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/append/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/assign/assign.cc: Likewise.
	* testsuite/experimental/filesystem/path/assign/copy.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/compare.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/strings.cc: Likewise.
	* testsuite/experimental/filesystem/path/concat/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/concat/strings.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/copy.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/default.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/construct/locale.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/range.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_name.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/generic/generic_string.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/itr/traversal.cc: Likewise.
	* testsuite/experimental/filesystem/path/modifiers/clear.cc: Likewise.
	* testsuite/experimental/filesystem/path/modifiers/make_preferred.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/remove_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/replace_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/replace_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/swap.cc: Likewise.
	* testsuite/experimental/filesystem/path/native/string.cc: Likewise.
	* testsuite/experimental/filesystem/path/nonmember/hash_value.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/empty.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/has_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_name.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/is_relative.cc:
	Likewise.

From-SVN: r259396
2018-04-16 09:24:40 +01:00
Jonathan Wakely 5f30251862 PR libstdc++/85222 allow catching iostream errors as gcc4-compatible ios::failure
Define a new exception type derived from std::ios::failure[abi:cxx11]
which also aggregates an object of the gcc4-compatible ios::failure
type. Make __throw_ios_failure throw this new type for iostream errors
that raise exceptions. Provide custom type info for the new type so that
it can be caught by handlers for the gcc4-compatible ios::failure type
as well as handlers for ios::failure[abi:cxx11] and its bases.

	PR libstdc++/85222
	* src/c++11/Makefile.am [ENABLE_DUAL_ABI]: Add special rules for
	cxx11-ios_failure.cc to rewrite type info for __ios_failure.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/cxx11-ios_failure.cc (__ios_failure, __iosfail_type_info):
	New types.
	[_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
	* src/c++11/ios.cc (__throw_ios_failure): Remove definition.
	* src/c++98/ios_failure.cc (__construct_ios_failure)
	(__destroy_ios_failure, is_ios_failure_handler): New functions.
	[!_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
	* testsuite/27_io/ios_base/failure/dual_abi.cc: New.
	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Revert changes to
	handler types, to always catch std::ios_base::failure.
	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/ios_base/storage/2.cc: Likewise.

From-SVN: r259281
2018-04-10 15:36:09 +01:00
Jonathan Wakely c73847e77b PR libstdc++/85183 fix std::variant move-assignment
PR libstdc++/85183
	* include/std/variant (_Move_assign_base::operator=): Fix incorrect
	value categories.
	* testsuite/20_util/variant/85183.cc: New.

From-SVN: r259059
2018-04-04 00:03:07 +01:00
Jonathan Wakely 7c69a7d9bd PR libstdc++/85040 fix std::less<void> etc. ambiguities
PR libstdc++/85040
	* include/bits/stl_function.h (greater::__not_overloaded)
	(less::__not_overloaded, greater_equal::__not_overloaded)
	(less_equal::__not_overloaded): Fix ambiguous specializations.
	* testsuite/20_util/function_objects/comparisons_pointer.cc: Add
	tests for type with overlaoded operators.

From-SVN: r258773
2018-03-22 14:23:27 +00:00
Rainer Orth 83872062cb xfail experimental/memory_resource/resource_adaptor.cc on 32-bit Solaris/x86 (PR libstdc++/77691)
PR libstdc++/77691
	* testsuite/experimental/memory_resource/resource_adaptor.cc:
	xfail execution on 32-bit Solaris/x86.

From-SVN: r258766
2018-03-22 13:33:29 +00:00
Jonathan Wakely 5a0729f5a4 Fix some libstdc++ testsuite failures
* testsuite/20_util/function_objects/comparisons_pointer.cc: Use
	VERIFY instead of assert.
	* testsuite/20_util/hash/84998.cc: New test.
	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc: New
	copy of test adjusted for Debug Mode.
	* testsuite/23_containers/vector/cons/destructible_neg.cc: Do not run
	test in Debug Mode.

From-SVN: r258714
2018-03-21 12:32:14 +00:00
Jonathan Wakely 0fb9dc36d2 Fix new test that fails in C++98 mode
* testsuite/20_util/function_objects/comparisons_pointer.cc: Adjust
	to compile as C++98.

From-SVN: r258623
2018-03-17 13:44:16 +00:00
Jonathan Wakely 0b3ec8f48f PR libstdc++/78420 Make std::less etc. yield total order for pointers
In order for std::less<T*> etc. to meet the total order requirements of
[comparisons] p2 we need to cast unrelated pointers to uintptr_t before
comparing them. Those casts aren't allowed in constant expressions, so
only cast when __builtin_constant_p says the result of the comparison is
not a compile-time constant (because the arguments are not constants, or
the result of the comparison is unspecified). When the result is
constant just compare the pointers directly without casting.

This ensures that the function can be called in constant expressions
with suitable arguments, but still yields a total order even for
otherwise unspecified pointer comparisons.

For std::less<void> etc. add new overloads for pointers, which use
std::less<common_type_t<T*,U*>> directly. Also change the generic
overloads to detect when the comparison would call a built-in relational
operator with pointer operands, and dispatch that case to the
corresponding specialization for void pointers.

	PR libstdc++/78420
	* include/bits/stl_function.h (greater<_Tp*>, less<_Tp*>)
	(greater_equal<_Tp*>, less_equal<_Tp>*): Add partial specializations
	to ensure total order for pointers.
	(greater<void>, less<void>, greater_equal<void>, less_equal<void>):
	Add operator() overloads for pointer arguments and make generic
	overloads dispatch to new _S_cmp functions when comparisons would
	use built-in operators for pointers.
	* testsuite/20_util/function_objects/comparisons_pointer.cc: New.

From-SVN: r258540
2018-03-14 23:02:01 +00:00
Jonathan Wakely 97ca95ac6f PR libstdc++/84773 use aligned alloc functions for FreeBSD and MinGW cross-compilers
PR libstdc++/84773
	PR libstdc++/83662
	* crossconfig.m4: Check for aligned_alloc etc. on freebsd and mingw32.
	* configure: Regenerate.
	* include/c_global/cstdlib [_GLIBCXX_HAVE_ALIGNED_ALLOC]
	(aligned_alloc): Add using-declaration.
	* testsuite/18_support/aligned_alloc/aligned_alloc.cc: New test.

From-SVN: r258468
2018-03-12 22:52:16 +00:00
François Dumont fe6bd21a0b printers.py (NodeIteratorPrinter): New.
2018-03-08  François Dumont  <fdumont@gcc.gnu.org>

	* python/libstdcxx/v6/printers.py (NodeIteratorPrinter): New.
	(StdListIteratorPrinter): Inherit from latter.
	(StdFwdListIteratorPrinter): New, inherit from latter.
	(StdDebugIteratorPrinter.to_string): Use non-debug iterator printer
	when iterator has no associated container.
	(build_libstdcxx_dictionary): Add __gnu_cxx::_Fwd_list_iterator and
	__gnu_cxx::_Fwd_list_const_iterator printers. Remove __norm namespace
	registrations.
	* testsuite/libstdc++-prettyprinters/debug.cc: Adapt.
	* testsuite/libstdc++-prettyprinters/debug_cxx11.cc: Adapt.

From-SVN: r258350
2018-03-08 06:26:15 +00:00
Ville Voutilainen 447346e465 re PR libstdc++/84601 (std::optional<std::pair<int, int>> is not assignment copyable)
PR libstdc++/84601
* include/std/optional (_Optional_payload): Split into multiple
specializations that can handle different cases of trivial or
non-trivial assignment operators.
* testsuite/20_util/optional/84601.cc: New.
* testsuite/20_util/optional/cons/value_neg.cc: Adjust.

From-SVN: r258304
2018-03-06 23:43:03 +02:00
Jonathan Wakely 2f03003dcc PR libstdc++/84671 handle digit separators in duration literals
PR libstdc++/84671
	* include/bits/parse_numbers.h (_Number_help): Add partial
	specialization to handle digit separators. Adjust partial
	specialization for recursion temrination to require _Pow == 1ULL.
	* testsuite/20_util/duration/literals/84671.cc: New

From-SVN: r258157
2018-03-02 20:38:50 +00:00
Ville Voutilainen 23c3a05908 Implement the missing bits of LWG 2769
* include/std/any (any_cast(const any&)): Add static_assert.
(any_cast(any&)): Likewise.
(any_cast(any&&)): Likewise, and remove the handling
for copyable-but-not-movable type.
* testsuite/20_util/any/misc/any_cast.cc: Adjust.
* testsuite/20_util/any/misc/any_cast_neg.cc: Likewise, and
add new tests.

From-SVN: r258031
2018-02-27 13:33:30 +02:00
Jonathan Wakely cc53514672 PR libstdc++/84532 prevent unwrapping of reference_wrapper arguments
PR libstdc++/84532
	* include/std/thread (thread::__make_invoker): Construct tuple
	directly instead of using make_tuple.
	* testsuite/30_threads/async/84532.cc: New.
	* testsuite/30_threads/thread/84532.cc: New.

From-SVN: r257956
2018-02-23 23:23:43 +00:00
Jonathan Wakely 670a8d7497 Remove duplicate "//" in comment
From-SVN: r257147
2018-01-29 14:09:52 +00:00
Jonathan Wakely 50ea03f403 PR libstdc++/83833 fix failing test on ia32
PR libstdc++/83833
	* testsuite/26_numerics/random/chi_squared_distribution/83833.cc:
	Add -ffloat-store to options for m68k and ia32.

From-SVN: r257146
2018-01-29 14:07:27 +00:00
Jonathan Wakely 73ebece382 PR libstdc++/83658 fix exception-safety in std::any::emplace
PR libstdc++/83658
	* include/std/any (any::__do_emplace): Only set _M_manager after
	constructing the contained object.
	* testsuite/20_util/any/misc/any_cast_neg.cc: Adjust dg-error line.
	* testsuite/20_util/any/modifiers/83658.cc: New test.

From-SVN: r257141
2018-01-29 12:33:32 +00:00
Jonathan Wakely 58078de77b PR libstdc++/81076 make __byte_operand SFINAE-friendly
PR libstdc++/81076
	* include/c_global/cstddef (__byte_operand): Define primary template.
	* testsuite/18_support/byte/81076.cc: New test.

From-SVN: r257050
2018-01-25 15:24:39 +00:00
Christophe Lyon a46c4287bb [libstdc++][testsuite] Fix dg-options/dg-add-options order
2018-01-19  Christophe Lyon  <christophe.lyon@linaro.org>

	* testsuite/ext/special_functions/airy_ai/check_nan.cc: Fix
          dg-options and dg-add-options order.
	* testsuite/ext/special_functions/airy_bi/check_nan.cc: Likewise.
	* testsuite/ext/special_functions/conf_hyperg/check_nan.cc:
	Likewise.
	* testsuite/ext/special_functions/hyperg/check_nan.cc: Likewise.
	* testsuite/special_functions/01_assoc_laguerre/check_nan.cc:
	Likewise.
	* testsuite/special_functions/02_assoc_legendre/check_nan.cc:
	Likewise.
	* testsuite/special_functions/03_beta/check_nan.cc: Likewise.
	* testsuite/special_functions/04_comp_ellint_1/check_nan.cc:
	Likewise.
	* testsuite/special_functions/05_comp_ellint_2/check_nan.cc:
	Likewise.
	* testsuite/special_functions/06_comp_ellint_3/check_nan.cc:
	Likewise.
	* testsuite/special_functions/06_comp_ellint_3/pr66689.cc:
	Likewise.
	* testsuite/special_functions/07_cyl_bessel_i/check_nan.cc:
	Likewise.
	* testsuite/special_functions/08_cyl_bessel_j/check_nan.cc:
	Likewise.
	* testsuite/special_functions/09_cyl_bessel_k/check_nan.cc:
	Likewise.
	* testsuite/special_functions/10_cyl_neumann/check_nan.cc:
	Likewise.
	* testsuite/special_functions/11_ellint_1/check_nan.cc: Likewise.
	* testsuite/special_functions/12_ellint_2/check_nan.cc: Likewise.
	* testsuite/special_functions/13_ellint_3/check_nan.cc: Likewise.
	* testsuite/special_functions/13_ellint_3/pr66689.cc: Likewise.
	* testsuite/special_functions/14_expint/check_nan.cc: Likewise.
	* testsuite/special_functions/15_hermite/check_nan.cc: Likewise.
	* testsuite/special_functions/16_laguerre/check_nan.cc: Likewise.
	* testsuite/special_functions/17_legendre/check_nan.cc: Likewise.
	* testsuite/special_functions/18_riemann_zeta/check_nan.cc:
	Likewise.
	* testsuite/special_functions/19_sph_bessel/check_nan.cc:
	Likewise.
	* testsuite/special_functions/20_sph_legendre/check_nan.cc:
	Likewise.
	* testsuite/special_functions/21_sph_neumann/check_nan.cc:
	Likewise.

From-SVN: r256879
2018-01-19 11:17:34 +01:00
Eric Botcazou 229433c94f * testsuite/17_intro/names.cc: Undefine 'y' on SPARC/Linux.
From-SVN: r256754
2018-01-16 20:40:09 +00:00
Jonathan Wakely 8b3085e7e8 PR libstdc++/83833 fix chi_squared_distribution::param(const param&)
PR libstdc++/83833
	* include/bits/random.h (chi_squared_distribution::param): Update
	gamma distribution parameter.
	* testsuite/26_numerics/random/chi_squared_distribution/83833.cc: New
	test.

From-SVN: r256708
2018-01-15 19:58:22 +00:00
Jonathan Wakely b0e63d9483 PR libstdc++/83830 Define std::has_unique_object_representations_v
PR libstdc++/83830
	* include/std/type_traits (has_unique_object_representations_v): Add
	variable template.
	* testsuite/20_util/has_unique_object_representations/value.cc: Check
	variable template.

From-SVN: r256701
2018-01-15 15:02:01 +00:00
Ville Voutilainen c89f2d2468 Make optional conditionally trivially_{copy,move}_{constructible,assignable}
* include/std/optional (_Optional_payload): Fix the comment in
the class head and turn into a primary and one specialization.
(_Optional_payload::_M_engaged): Strike the NSDMI.
(_Optional_payload<_Tp, false>::operator=(const _Optional_payload&)):
New.
(_Optional_payload<_Tp, false>::operator=(_Optional_payload&&)):
Likewise.
(_Optional_payload<_Tp, false>::_M_get): Likewise.
(_Optional_payload<_Tp, false>::_M_reset): Likewise.
(_Optional_base_impl): Likewise.
(_Optional_base): Turn into a primary and three specializations.
(optional(nullopt)): Change the base init.
* testsuite/20_util/optional/assignment/8.cc: New.
* testsuite/20_util/optional/cons/trivial.cc: Likewise.
* testsuite/20_util/optional/cons/value_neg.cc: Adjust.

From-SVN: r256694
2018-01-15 13:32:24 +02:00
Jonathan Wakely bab0a26de5 PR libstdc++/80276 fix template argument handling in type printers
PR libstdc++/80276
	* python/libstdcxx/v6/printers.py (strip_inline_namespaces): New.
	(get_template_arg_list): New.
	(StdVariantPrinter._template_args): Remove, use get_template_arg_list
	instead.
	(TemplateTypePrinter): Rewrite to work with gdb.Type objects instead
	of strings and regular expressions.
	(add_one_template_type_printer): Adapt to new TemplateTypePrinter.
	(FilteringTypePrinter): Add docstring. Match using startswith. Use
	strip_inline_namespaces instead of strip_versioned_namespace.
	(add_one_type_printer): Prepend namespace to match argument.
	(register_type_printers): Add type printers for char16_t and char32_t
	string types and for types using cxx11 ABI. Update calls to
	add_one_template_type_printer to provide default argument dicts.
	* testsuite/libstdc++-prettyprinters/80276.cc: New test.
	* testsuite/libstdc++-prettyprinters/whatis.cc: Remove tests for
	basic_string<unsigned char> and basic_string<signed char>.
	* testsuite/libstdc++-prettyprinters/whatis2.cc: Duplicate whatis.cc
	to test local variables, without overriding _GLIBCXX_USE_CXX11_ABI.

From-SVN: r256689
2018-01-15 11:13:53 +00:00
Tim Shen 8532713fc4 re PR libstdc++/83601 (std::regex_replace C++14 conformance issue: escaping in SED mode)
PR libstdc++/83601
	* include/bits/regex.tcc (regex_replace): Fix escaping in sed.
	* testsuite/28_regex/algorithms/regex_replace/char/pr83601.cc: Tests.
	* testsuite/28_regex/algorithms/regex_replace/wchar_t/pr83601.cc: Tests.

From-SVN: r256654
2018-01-14 00:48:30 +00:00
Rainer Orth c969e34e3f Link with correct values-*.o files on Solaris (PR target/40411)
gcc/testsuite:
	PR libfortran/67412
	* gfortran.dg/execute_command_line_2.f90: Remove dg-xfail-run-if
	on *-*-solaris2.10.

	libstdc++-v3:
	PR libstdc++/64054
	* testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc:
	Remove dg-xfail-run-if.

	gcc:
	PR target/40411
	* config/sol2.h (STARTFILE_ARCH_SPEC): Don't use with -shared or
	-symbolic.
	Use values-Xc.o for -pedantic.
	Link with values-xpg4.o for C90, values-xpg6.o otherwise.

From-SVN: r256568
2018-01-12 09:52:53 +00:00
François Dumont 75ce74bbdd 2018-01-10 François Dumont <fdumont@gcc.gnu.org>
* include/bits/forward_list.h
	(_Fwd_list_node_base(_Fwd_list_node_base&&)): New.
	(_Fwd_list_node_base& operator=(_Fwd_list_node_base&&)): New.
	(_Fwd_list_node_base(const _Fwd_list_node_base&)): Explicit delete.
	(_Fwd_list_node_base& operator=(const _Fwd_list_node_base&)): Likewise.
	(_Fwd_list_impl()): Add noexcept qualification.
	(_Fwd_list_impl(const _Node_alloc_type&)): Delete.
	(_Fwd_list_impl(_Fwd_list_impl&&)): New, default.
	(_Fwd_list_impl(_Fwd_list_impl&&, _Node_alloc_type&&)): New.
	(_Fwd_list_base()): Default.
	(_Fwd_list_base(_Fwd_list_base&&, _Node_alloc_type&&, true_type)): New.
	(_Fwd_list_base(_Fwd_list_base&&)): Default.
	(forward_list<>()): Default.
	(forward_list<>(forward_list&&)): Default.
	(forward_list(forward_list&&, _Node_alloc_type&&, false_type)): New.
	(forward_list(forward_list&&, _Node_alloc_type&&, true_type)): New.
	(forward_list(forward_list&&, const _Alloc&)): Adapt to use latters.
	* include/bits/forward_list.tcc
	(_Fwd_list_base(_Fwd_list_base&&, _Node_alloc_type&&)): Adapt to use
	_M_impl._M_head move assignment.
	(forward_list<>::merge(forward_list<>&&, _Comp)): Likewise.
	* testsuite/23_containers/forward_list/allocator/default_init.cc: New.

From-SVN: r256439
2018-01-10 16:59:02 +00:00
Jonathan Wakely 8273aa77d4 PR libstdc++/80276 fix pretty printers for array smart pointers
PR libstdc++/80276
	* python/libstdcxx/v6/printers.py (SharedPointerPrinter)
	(UniquePointerPrinter): Print correct template argument, not type of
	the pointer.
	(TemplateTypePrinter._recognizer.recognize): Handle failure to lookup
	a type.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Test unique_ptr of
	array type.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Test shared_ptr and
	weak_ptr of array types.

From-SVN: r256400
2018-01-09 21:46:13 +00:00
François Dumont 0f1462579e re PR libstdc++/83709 (Inserting duplicates into an unordered associative containers causes the container to invalidate iterators)
2018-01-09  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/83709
	* include/bits/hashtable_policy.h
	(__distance_fwd(_Iterator, _Iterator, input_iterator_tag)): Return 1 if
	__first != __last.
	(_Insert_base::_M_insert_range(_Ite, _Ite, _NodeGetter, true_type)): New.
	(_Insert_base::_M_insert_range(_Ite, _Ite, _NodeGetter, false_type)):
	Add false_type parameter.
	(_Insert_base::insert): Adapt.
	* include/bits/hashtable.h (_Hashtable::operator=(initializzr_list<>)):
	Adapt.
	(_Hashtable::_M_insert(_Arg&&, const _NodeGen&, true_type, size_t)):
	 Add __n_elt parameter, defaulted to 1.
	(_Hashtable::_M_insert_unique_node): Likewise. Use it to call rehash
	policy _M_need_rehash.
	(_Hashtable::_M_merge_unique): Pass target number of elements to add to
	produce only 1 rehash if necessary.
	* testsuite/23_containers/unordered_map/insert/83709.cc: New.
	* testsuite/23_containers/unordered_set/insert/83709.cc: New.

From-SVN: r256396
2018-01-09 21:05:10 +00:00
Juraj Oršulić d2dfcf823c PR libstdc++/59253 Improve pretty printers for smart pointers
PR libstdc++/59253 (partial)
	* python/libstdcxx/v6/printers.py (SmartPtrIterator): Common iterator
	type for pointer stored by shared_ptr, weak_ptr and unique_ptr.
	(SharedPointerPrinter, UniquePointerPrinter): Treat stored values as
	children.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Update expected output
	of unique_ptr printer.
	* testsuite/libstdc++-prettyprinters/shared_ptr.cc: Update expected
	output of shared_ptr printer.

From-SVN: r256390
2018-01-09 18:49:57 +00:00
Jonathan Wakely 388058dd06 PR libstdc++/83626 handle ENOENT due to filesystem race
PR libstdc++/83626
	* src/filesystem/ops.cc (remove(const path&, error_code&)): Do not
	report an error for ENOENT.
	(remove_all(const path&)): Fix type of result variable.
	(remove_all(const path&, error_code&)): Use non-throwing increment
	for directory iterator. Call POSIX remove directly to avoid redundant
	calls to symlink_status. Do not report errors for ENOENT.
	* src/filesystem/std-ops.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove_all.cc: Test throwing
	overload.
	* testsuite/experimental/filesystem/operations/remove_all.cc:
	Likewise.

From-SVN: r256283
2018-01-05 18:02:18 +00:00
Jonathan Wakely 994844d36a PR libstdc++/83626 Don't throw for remove("") and remove_all("")
PR libstdc++/83626
	* src/filesystem/ops.cc (remove(const path&, error_code&))): Remove
	redundant call to ec.clear().
	(remove_all(const path&, error_code&))): Do not return an error for
	non-existent paths.
	* src/filesystem/std-ops.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove.cc: New test.
	* testsuite/27_io/filesystem/operations/remove_all.cc: Fix expected
	results for non-existent paths.
	* testsuite/experimental/filesystem/operations/remove.cc: New test.
	* testsuite/experimental/filesystem/operations/remove_all.cc: Fix
	expected results for non-existent paths.

From-SVN: r256269
2018-01-04 22:58:59 +00:00
Jonathan Wakely 32489ab56a PR libstdc++/83607 specialize Boyer-Moore searchers for std::byte
PR libstdc++/83607
	* include/std/functional (__is_byte_like): New trait.
	(__is_std_equal_to): Remove.
	(__boyer_moore_base_t): Use __is_byte_like instead of
	__is_std_equal_to.
	* include/experimental/functional (__is_std_equal_to): Remove.
	(__boyer_moore_base_t): Use __is_byte_like instead of
	__is_std_equal_to.
	* testsuite/20_util/function_objects/83607.cc: New test.

From-SVN: r256231
2018-01-04 10:21:29 +00:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Jonathan Wakely ecba356686 PR libstdc++/83600 fix end iterator for unready std::match_results
PR libstdc++/83600
	* include/bits/regex.h (match_results::end()): Return valid iterator
	when not ready.
	* testsuite/28_regex/match_results/ctors/char/default.cc: Check that
	unready objects are empty and have equal begin and end iterators.
	* testsuite/28_regex/match_results/ctors/wchar_t/default.cc: Likewise.

From-SVN: r256014
2017-12-27 22:18:08 +00:00
Jonathan Wakely 8afe2df012 PR libstdc++/83598 don't modify flags passed to std::basic_regex constructors
PR libstdc++/83598
	* include/bits/regex.h (basic_regex): Don't modify flags passed to
	constructors.
	* testsuite/28_regex/basic_regex/ctors/83598.cc: New test.

From-SVN: r256013
2017-12-27 22:18:02 +00:00
Jonathan Wakely c41743d0c0 PR libstdc++/83538 fix std::match_results<T>::reference (LWG 2306)
PR libstdc++/83538
	* doc/xml/manual/intro.xml: Document LWG 2306 change.
	* include/bits/regex.h (match_results::reference): Change to
	non-const reference.
	* testsuite/28_regex/match_results/typedefs.cc: Check types are
	correct.

From-SVN: r256012
2017-12-27 19:43:33 +00:00
Michele Pezzutti 73986c315b re PR libstdc++/83237 (Values returned by std::poisson_distribution are not distributed correctly)
2017-12-24  Michele Pezzutti <mpezz@tiscali.it>

	PR libstdc++/83237
	* include/bits/random.tcc (poisson_distribution<>::operator()):
	Fix __x = 1 case - see updated Errata of Devroye's treatise.
	* testsuite/26_numerics/random/poisson_distribution/operators/
	values.cc: Add test.
	* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
	line number.

From-SVN: r255993
2017-12-24 22:08:52 +00:00
Jonathan Wakely 4f9621392f PR libstdc++/83450 avoid -Wreturn-type warning in test
PR libstdc++/83450
	* testsuite/21_strings/basic_string/pthread18185.cc: Add return
	statement.

From-SVN: r255992
2017-12-24 09:17:38 +00:00
François Dumont 1679da1571 re PR libstdc++/82522 (std::map::insert(value_type &&) not selected)
2017-12-20  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/82522
	* include/debug/map.h (map::insert(value_type&&))
	(map::insert(const_iterator, value_type&&)): Add overload for rvalues.
	* include/debug/multimap.h (multimap::insert(value_type&&))
	(multimap::insert(const_iterator, value_type&&)): Likewise.
	* include/debug/unordered_map (unordered_map::insert(value_type&&))
	(unordered_map::insert(const_iterator, value_type&&))
	(unordered_multimap::insert(value_type&&))
	(unordered_multimap::insert(const_iterator, value_type&&)): Likewise.
	* testsuite/23_containers/map/modifiers/insert/dr2354.cc (test02): New.
	* testsuite/23_containers/multimap/modifiers/insert/dr2354.cc (test02):
	New.
	* testsuite/23_containers/unordered_map/insert/dr2354.cc (test02): New.
	* testsuite/23_containers/unordered_multimap/insert/dr2354.cc (test02):
	New.

From-SVN: r255904
2017-12-20 21:53:25 +00:00
Ville Voutilainen 5dd44f4ea5 re PR libstdc++/68430 (std::is_constructible<T>::value == true for unconstructible type T)
PR libstdc++/68430

* testsuite/20_util/is_constructible/68430.cc: New.

From-SVN: r255785
2017-12-18 20:46:30 +02:00