Commit Graph

4242 Commits

Author SHA1 Message Date
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
Jonathan Wakely 83fd5e73b3 PR libstdc++/68519 use native duration to avoid rounding errors
PR libstdc++/68519
	* include/std/condition_variable (condition_variable::wait_for):
	Convert duration to native clock's duration before addition.
	* testsuite/30_threads/condition_variable/members/68519.cc: New test.

From-SVN: r255665
2017-12-14 20:41:52 +00:00
Jonathan Wakely 00677c4877 PR libstdc++/83427 detect weak result type from noexcept functions
PR libstdc++/83427
	* include/bits/refwrap.h (_Maybe_unary_or_binary_function): Move here
	from <bits/std_function.h>.
	(_Mem_fn_traits_base, _Mem_fn_traits): Move here, from <functional>.
	(_Weak_result_type_impl, _Reference_wrapper_base): Deduce noexcept
	for function types. Remove partial specializations for member
	functions.
	(_Weak_result_type_impl): Remove unused partial specializations for
	non-referenceable function types and for references to functions.
	(_Weak_result_type_memfun, _Reference_wrapper_base_memfun): New
	helpers to handle member functions via _Mem_fn_traits.
	(_Weak_result_type, reference_wrapper): Derive from new helpers.
	* include/bits/std_function.h (_Maybe_unary_or_binary_function): Move
	to <bits/refwrap.h>.
	* include/std/functional (_Pack, _AllConvertible, _NotSame): Remove.
	(_Mem_fn_traits_base, _Mem_fn_traits): Move to <bits/refwrap.h>.
	* testsuite/20_util/bind/83427.cc: New test.
	* testsuite/20_util/bind/refqual.cc: Add noexcept to functions and
	check for weak result types.
	* testsuite/20_util/reference_wrapper/83427.cc: New test.

From-SVN: r255651
2017-12-14 17:18:22 +00:00
Jonathan Wakely f297ebafdc Test whitespace handling in std::complex extraction
* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:
	Add tests using noskipws.

From-SVN: r255632
2017-12-14 11:47:42 +00:00
Jonathan Wakely 02aee32767 Improve std::complex test and move to sub-directory
* testsuite/26_numerics/complex/dr2714.cc: Move to ...
	* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:
	... Here. Remove duplicate header and dg-options. Check first invalid
	character gets putback. Remove wchar_t test.

From-SVN: r255630
2017-12-14 11:28:41 +00:00
Jonathan Wakely 3ca652c199 PR libstdc++/59568 fix error handling for std::complex stream extraction
PR libstdc++/59568
	* include/std/complex (operator>>): Implement proposed resolution to
	LWG 2714. Use putback if and only if a character has been successfully
	extracted but isn't a delimiter. Use ctype::widen and traits::eq when
	testing if extracted characters match delimiters.
	* testsuite/26_numerics/complex/dr2714.cc: New test.

From-SVN: r255608
2017-12-13 17:02:14 +00:00
Jonathan Wakely 91d01b33e8 PR libstdc++/83395 fix invocable traits for INVOKE<cv void>
PR libstdc++/83395
	* include/std/type_traits (__is_invocable_impl): Remove partial
	specialization for INVOKE<void> and restore is_void<R> check in
	primary template.
	(__is_nt_invocable_impl): Likewise.
	* testsuite/20_util/is_invocable/83395.cc: New test.
	* testsuite/20_util/is_nothrow_invocable/83395.cc: New test.

From-SVN: r255584
2017-12-12 17:42:19 +00:00
David Edelsohn d3861707eb re PR libstdc++/83120 (ext/special_functions/hyperg failure on AIX)
PR libstdc++/83120
        * testsuite/ext/special_functions/hyperg/check_value.cc: Add
        -ffp-contract=off. Add -ffloat-store for m68* and ia32.
        * testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/check_value.cc: Same.

From-SVN: r255483
2017-12-07 15:05:59 -05:00
Jonathan Wakely 9ed83a33c0 Fix -Wunused warnings in libstdc++ headers
* config/io/basic_file_stdio.h (__basic_file): Remove name of unused
	parameter.
	* include/bits/boost_concept_check.h: Add pragmas to disable
	-Wunused-local-typedef warnings.
	* include/bits/codecvt.h (codecvt_byname<char16_t, char, mbstate_t>)
	(codecvt_byname<char32_t, char, mbstate_t>): Remove name of unused
	parameter.
	* include/bits/locale_facets_nonio.tcc (time_get::do_get_weekday)
	(time_get::do_get_monthname, time_get::do_get_year): Remove unused
	variables.
	* include/std/bitset (_Base_bitset<0>::_M_getword): Remove name of
	unused parameter.
	* include/std/streambuf (_IsUnused): Define.
	(basic_streambuf::imbue, basic_streambuf::pbackfail)
	(basic_streambuf::overflow): Add macro to unused parameters.
	* testsuite/24_iterators/operations/prev_neg.cc: Adjust dg-error.

From-SVN: r255391
2017-12-04 23:07:39 +00:00
Jonathan Wakely f03858e51d Disable -Wliteral-suffix for standard UDLs
* include/bits/basic_string.h (operator""s): Add pragmas to disable
	-Wliteral-suffix warnings.
	* include/experimental/string_view (operator""sv): Likewise.
	* include/std/chrono (operator""h, operator""min, operator""s)
	(operator""ms, operator""us, operator""ns): Likewise.
	* include/std/complex (operator""if, operator""i, operator""il):
	Likewise.
	* include/std/string_view (operator""sv): Likewise.
	* testsuite/20_util/duration/literals/range.cc: Adjust dg-error.

From-SVN: r255320
2017-12-01 16:10:25 +00:00
Glen Joseph Fernandes 6b590c7a64 Move assertion from to_address to __to_address
2017-11-30  Glen Joseph Fernandes  <glenjofe@gmail.com>

	* include/bits/ptr_traits.h (__to_address, to_address): Move static
	assertion.
	* testsuite/20_util/to_address/1_neg.cc: New test.

From-SVN: r255277
2017-11-30 15:07:21 +00:00
Jonathan Wakely 5f939178ec PR libstdc++/83226 avoid forming pointer-to-reference type
PR libstdc++/83226
	* include/bits/node_handle.h (_Node_handle::__pointer): Avoid forming
	pointer-to-reference types.
	* testsuite/23_containers/map/modifiers/insert/83226.cc: New test.

From-SVN: r255271
2017-11-30 13:45:37 +00:00
David Malcolm 591996bad7 C++: improve location of static_assert errors
gcc/cp/ChangeLog:
	* parser.c (cp_parser_unary_expression): Generate a location for
	"noexcept".
	(cp_parser_trait_expr): Generate and return a location_t,
	converting the return type from tree to cp_expr.
	(cp_parser_static_assert): Pass location of the condition to
	finish_static_assert, rather than that of the "static_assert"
	token, where available.

gcc/testsuite/ChangeLog:
	* g++.dg/cpp1y/static_assert3.C: New test case.

libstdc++-v3/ChangeLog:
	* testsuite/20_util/duration/literals/range.cc: Update expected
	line of a static_assert failure.

From-SVN: r255255
2017-11-29 22:07:32 +00:00
Glen Joseph Fernandes 61cd19e6be Add std::to_address for C++2a (P0653R2)
2017-11-28  Glen Joseph Fernandes  <glenjofe@gmail.com>

	* include/bits/ptr_traits.h (to_address): Implement to_address.
	* testsuite/20_util/to_address/1.cc: New test.

From-SVN: r255199
2017-11-28 14:22:32 +00:00
Jonathan Wakely a8541d9021 Add [[nodiscard]] attribute to std::launder
* libsupc++/new (launder): Add nodiscard attribute.
	* testsuite/18_support/launder/nodiscard.cc: New test.

From-SVN: r255127
2017-11-24 00:00:46 +00:00
Jonathan Wakely d69f1ec7d1 Add [[nodiscard]] attribute to C++17 components
* include/bits/fs_path.h (path::empty): Add nodiscard attribute.
	* include/bits/range_access.h (empty): Likewise.
	* include/std/string_view (basic_string_view::empty): Likewise.
	* testsuite/21_strings/basic_string_view/capacity/empty_neg.cc: New
	test.
	* testsuite/24_iterators/range_access_cpp17_neg.cc: New test.
	* testsuite/27_io/filesystem/path/query/empty_neg.cc: New test.

From-SVN: r255124
2017-11-23 22:11:21 +00:00
Jonathan Wakely 4b9840f230 PR libstdc++/83134 Ensure std::__not_ converts B::value to bool
PR libstdc++/83134
	* include/std/type_traits (__not_): Explicitly convert to bool.
	* testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error.
	* testsuite/20_util/logical_traits/83134.cc: New test.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
	dg-error.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.

From-SVN: r255122
2017-11-23 21:35:27 +00:00
Jonathan Wakely 866e4d3853 PR libstdc++/48101 improve errors for invalid container specializations
PR libstdc++/48101
	* include/bits/allocator.h (allocator<const _Tp>)
	(allocator<volatile _Tp>, allocator<const volatile _Tp>): Add partial
	specializations.
	* include/bits/forward_list.h (forward_list): Add static assertions.
	* include/bits/hashtable.h (__cache_default): Use
	__is_nothrow_invocable instead of __is_noexcept_hash.
	(_Hashtable): Add static assertions.
	* include/bits/hashtable_policy.h (__is_noexcept_hash): Remove.
	* include/bits/stl_deque.h (deque): Add static assertions.
	* include/bits/stl_function.h (_Identity<const _Tp>): Add partial
	specialization.
	* include/bits/stl_list.h (list): Add static assertions.
	* include/bits/stl_map.h (map): Likewise.
	* include/bits/stl_multimap.h (multimap): Likewise.
	* include/bits/stl_multiset.h (multiset): Likewise.
	* include/bits/stl_set.h (set): Likewise.
	* include/bits/stl_tree.h (_Rb_tree): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.
	* include/bits/unordered_map.h (unordered_map, unordered_multimap):
	Use typename instead of class in template-parameter-list and remove
	spaces.
	* include/bits/unordered_set.h (unordered_set, unordered_multiset):
	Likewise.
	* testsuite/23_containers/deque/48101-2_neg.cc: New test.
	* testsuite/23_containers/deque/48101_neg.cc: New test.
	* testsuite/23_containers/forward_list/48101-2_neg.cc: New test.
	* testsuite/23_containers/forward_list/48101_neg.cc: New test.
	* testsuite/23_containers/list/48101-2_neg.cc: New test.
	* testsuite/23_containers/list/48101_neg.cc: New test.
	* testsuite/23_containers/map/48101-2_neg.cc: New test.
	* testsuite/23_containers/map/48101_neg.cc: New test.
	* testsuite/23_containers/map/operations/31440.cc: Fix comparison
	object to have const-qualified call operator.
	* testsuite/23_containers/multimap/48101-2_neg.cc: New test.
	* testsuite/23_containers/multimap/48101_neg.cc: New test.
	* testsuite/23_containers/multiset/48101-2_neg.cc: New test.
	* testsuite/23_containers/multiset/48101_neg.cc: New test.
	* testsuite/23_containers/set/48101-2_neg.cc: New test.
	* testsuite/23_containers/set/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_map/48101-2_neg.cc: New test.
	* testsuite/23_containers/unordered_map/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/48101-2_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/48101-2_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_set/48101-2_neg.cc: New test.
	* testsuite/23_containers/unordered_set/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust
	dg-error line number.
	* testsuite/23_containers/vector/48101-2_neg.cc: New test.
	* testsuite/23_containers/vector/48101_neg.cc: New test.

From-SVN: r255035
2017-11-21 20:47:09 +00:00
François Dumont e324f9cb92 streambuf_iterator.h (istreambuf_iterator<>): Declare std::advance for istreambuf_iterator of char types to be friend.
2017-11-20  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/streambuf_iterator.h (istreambuf_iterator<>): Declare
	std::advance for istreambuf_iterator of char types to be friend.
	(std::advance(istreambuf_iterator&, _Distance)): New overload.
	* include/std/streambuf (basic_streambuf<>): Declare std::advance for
	istreambuf_iterator of char types to be friend.
	* testsuite/22_locale/money_get/get/char/9.cc: Have
	istreambuf_iterator created on the fly when calling money_get<>::get.
	* testsuite/22_locale/money_get/get/wchar_t/9.cc: Likewise.
	* testsuite/24_iterators/istreambuf_iterator/debug/1_neg.cc: New.
	* testsuite/24_iterators/istreambuf_iterator/debug/2_neg.cc: New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/1.cc: New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/1_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc: New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/2_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/3_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/1.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/1_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/3_neg.cc:
	New.
	* testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc: Leverage
	on std::advance overload.
	* testsuite/25_algorithms/find/istreambuf_iterators/wchar_t/2.cc:
	Likewise.

From-SVN: r254972
2017-11-20 22:30:28 +00:00
Jonathan Wakely 9be0a9d6d2 Fix failing tests caused by duplicate dg-options
* testsuite/special_functions/18_riemann_zeta/check_value.cc: Fix
	duplicate dg-options directive.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	20_riemann_zeta/check_value_neg.cc: Likewise.

From-SVN: r254971
2017-11-20 21:48:31 +00:00
Ville Voutilainen 7b7b60c830 Implement LWG 2353
* include/bits/stl_iterator_base_funcs.h (next):
Use InputIterator instead of ForwardIterator.
* testsuite/24_iterators/operations/lwg2353.cc: New.
* testsuite/24_iterators/operations/next_neg.cc: Remove.

From-SVN: r254957
2017-11-20 16:21:42 +02:00
Edward Smith-Rowland b46881363f PR libstdc++/pr66689 - comp_ellint_3 and ellint_3 return garbage values
2017-11-18  Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/pr66689 - comp_ellint_3 and ellint_3 return garbage values
	* include/tr1/ell_integral.tcc: Correct the nu sign convention
	in ellint_3 and comp_ellint_3.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	06_comp_ellint_3/check_value.cc: Regen with correct values.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	14_ellint_3/check_value.cc: Ditto.
	* testsuite/special_functions/06_comp_ellint_3/check_value.cc: Ditto.
	* testsuite/special_functions/13_ellint_3/check_value.cc: Ditto.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	01_assoc_laguerre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	02_assoc_legendre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	03_beta/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	04_comp_ellint_1/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	05_comp_ellint_2/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	07_conf_hyperg/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	08_cyl_bessel_i/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	09_cyl_bessel_j/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	10_cyl_bessel_k/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	11_cyl_neumann/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	12_ellint_1/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	13_ellint_2/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	15_expint/check_value_neg.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	16_hermite/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	17_hyperg/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	18_laguerre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	19_legendre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	20_riemann_zeta/check_value_neg.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	21_sph_bessel/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	22_sph_legendre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	23_sph_neumann/check_value.cc: Regen.
	* testsuite/ext/special_functions/conf_hyperg/check_value.cc: Regen.
	* testsuite/ext/special_functions/hyperg/check_value.cc: Regen.
	* testsuite/special_functions/01_assoc_laguerre/check_value.cc: Regen.
	* testsuite/special_functions/02_assoc_legendre/check_value.cc: Regen.
	* testsuite/special_functions/03_beta/check_value.cc: Regen.
	* testsuite/special_functions/04_comp_ellint_1/check_value.cc: Regen.
	* testsuite/special_functions/05_comp_ellint_2/check_value.cc: Regen.
	* testsuite/special_functions/07_cyl_bessel_i/check_value.cc: Regen.
	* testsuite/special_functions/08_cyl_bessel_j/check_value.cc: Regen.
	* testsuite/special_functions/09_cyl_bessel_k/check_value.cc: Regen.
 	* testsuite/special_functions/10_cyl_neumann/check_value.cc: Regen.
	* testsuite/special_functions/11_ellint_1/check_value.cc: Regen.
	* testsuite/special_functions/12_ellint_2/check_value.cc: Regen.
	* testsuite/special_functions/14_expint/check_value.cc: Regen.
	* testsuite/special_functions/15_hermite/check_value.cc: Regen.
	* testsuite/special_functions/16_laguerre/check_value.cc: Regen.
	* testsuite/special_functions/17_legendre/check_value.cc: Regen.
	* testsuite/special_functions/18_riemann_zeta/check_value.cc: Regen.
	* testsuite/special_functions/19_sph_bessel/check_value.cc: Regen.
	* testsuite/special_functions/20_sph_legendre/check_value.cc: Regen.
	* testsuite/special_functions/21_sph_neumann/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	06_comp_ellint_3/pr66689.cc: New.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	14_ellint_3/pr66689.cc: New.
	* testsuite/special_functions/06_comp_ellint_3/pr66689.cc: New.
	* testsuite/special_functions/13_ellint_3/pr66689.cc: New.

From-SVN: r254924
2017-11-19 01:01:50 +00:00
Edward Smith-Rowland a7a389d6ee specfun.h: Expose airy_ai and airy_bi.
2017-11-18  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* include/bits/specfun.h: Expose airy_ai and airy_bi.
	* include/tr1/modified_bessel_func.tcc: Treat NaN and inf arg, return.
	* testsuite/ext/special_functions/airy_ai/check_nan.cc: New.
	* testsuite/ext/special_functions/airy_ai/check_value.cc: New.
	* testsuite/ext/special_functions/airy_ai/compile.cc: New.
	* testsuite/ext/special_functions/airy_bi/check_nan.cc: New.
	* testsuite/ext/special_functions/airy_bi/check_value.cc: New.
	* testsuite/ext/special_functions/airy_bi/compile.cc: New.

From-SVN: r254917
2017-11-18 19:53:25 +00:00
Igor Tsimbalist 36101de964 Enable building libstdc++-v3 with Intel CET
libstdc++-v3/
	* acinclude.m4: Add cet.m4.
	* configure.ac: Set CET_FLAGS. Update EXTRA_CFLAGS,
	EXTRA_CXX_FLAGS.
	* libsupc++/Makefile.am: Use Add EXTRA_CFLAGS.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.
	* include/Makefile.in: Likewise.
	* libsupc++/Makefile.in: Likewise.
	* po/Makefile.in: Likewise.
	* python/Makefile.in: Likewise.
	* src/Makefile.in: Likewise.
	* src/c++11/Makefile.in: Likewise.
	* src/c++98/Makefile.in: Likewise.
	* src/filesystem/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r254895
2017-11-17 22:28:10 +01:00
Jonathan Wakely 96e0367ead PR libstdc++/83025 fix constraints for path overloads in <fstream>
PR libstdc++/83025
	* include/std/fstream (basic_filebuf::_If_path): Move to
	namespace-scope and rename to _If_fs_path.
	(basic_filebuf::open): Use new name.
	(basic_ifstream(_Path, ios::openmode))
	(basic_ifstream::open(_Path, ios::openmode))
	(basic_ofstream(_Path, ios::openmode))
	(basic_ofstream::open(_Path, ios::openmode))
	(basic_fstream(_Path, ios::openmode))
	(basic_fstream::open(_Path, ios::openmode)): Use _If_fs_path.
	* testsuite/27_io/basic_filebuf/open/char/path.cc: Test with filename
	as non-const char*.
	* testsuite/27_io/basic_fstream/cons/char/path.cc: Likewise.
	* testsuite/27_io/basic_fstream/open/char/path.cc: Likewise.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc: Likewise.
	* testsuite/27_io/basic_ifstream/open/char/path.cc: Likewise.
	* testsuite/27_io/basic_ofstream/cons/char/path.cc: Likewise.
	* testsuite/27_io/basic_ofstream/open/char/path.cc: Likewise.

From-SVN: r254871
2017-11-17 14:07:58 +00:00
Jonathan Wakely 4e6c429837 Minor improvements to Filesystem tests
* testsuite/27_io/filesystem/iterators/directory_iterator.cc: Leave
	error_code unset.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	Check for past-the-end before dereferencing.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.

From-SVN: r254781
2017-11-15 18:22:43 +00:00
Ville Voutilainen 13545f19e0 Implement LWG 2733 and LWG 2759
* include/experimental/numeric (gcd): Reject cv-qualified bool.
(lcm): Likewise.
* include/std/numeric (gcd): Likewise.
(lcm): Likewise.
* testsuite/26_numerics/gcd/gcd_neg.cc: Add tests and adjust.
* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.

From-SVN: r254736
2017-11-14 20:11:33 +02:00
Jonathan Wakely d2e9196e5f Fix typo in std::wbuffer_convert
* include/bits/locale_conv.h (wbuffer_convert::_M_conv_get): Fix typo.
	* testsuite/22_locale/conversions/buffer/3.cc: New test.

From-SVN: r254735
2017-11-14 18:00:53 +00:00
Jonathan Wakely 34c71b8b3a Minor tweak to libstdc++ testsuite helper type
* testsuite/util/testsuite_tr1.h (ThrowMoveConsClass): Use noexcept.

From-SVN: r254644
2017-11-11 00:10:07 +00:00
François Dumont 187e8ee733 tr1.cc: Compile with -O0.
2017-11-06  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/libstdc++-prettyprinters/tr1.cc:  Compile with -O0.

From-SVN: r254477
2017-11-06 21:15:48 +00:00
Martin Liska 454f8b2b0c Fix -Wreturn-type fallout.
2017-11-06  Martin Liska  <mliska@suse.cz>

	* c-c++-common/cilk-plus/AN/pr57541-2.c (foo1): Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	(foo2): Likewise.
	* c-c++-common/cilk-plus/AN/pr57541.c (foo): Likewise.
	(foo1): Likewise.
	* c-c++-common/cilk-plus/CK/errors.c: Likewise.
	* c-c++-common/cilk-plus/CK/pr60197.c: Likewise.
	* c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise.
	* c-c++-common/fold-masked-cmp-1.c (test_pic): Likewise.
	(test_exe): Likewise.
	* c-c++-common/fold-masked-cmp-2.c (test_exe): Likewise.
	* g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc (my_func): Likewise.
	* g++.dg/cilk-plus/CK/pr68997.cc (fa2): Likewise.
	* g++.dg/eh/sighandle.C (dosegv): Likewise.
	* g++.dg/ext/vector14.C (foo): Likewise.
	(main): Likewise.
	* g++.dg/graphite/pr41305.C: Likewise.
	* g++.dg/graphite/pr42930.C: Likewise.
	* g++.dg/opt/pr46640.C (struct QBasicAtomicInt): Likewise.
	(makeDir): Likewise.
	* g++.dg/other/i386-8.C (foo): Likewise.
	* g++.dg/pr45788.C: Likewise.
	* g++.dg/pr64688.C (at_c): Likewise.
	* g++.dg/pr65032.C (G::DecodeVorbis): Likewise.
	* g++.dg/pr71633.C (c3::fn2): Likewise.
	* g++.dg/stackprotectexplicit2.C (A): Likewise.
	* g++.old-deja/g++.law/weak.C (main): Likewise.
2017-11-06  Martin Liska  <mliska@suse.cz>

	* testsuite/libgomp.c++/loop-2.C: Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	* testsuite/libgomp.c++/loop-4.C: Likewise.
	* testsuite/libgomp.c++/parallel-1.C: Likewise.
	* testsuite/libgomp.c++/shared-1.C: Likewise.
	* testsuite/libgomp.c++/single-1.C: Likewise.
	* testsuite/libgomp.c++/single-2.C: Likewise.
2017-11-06  Martin Liska  <mliska@suse.cz>

	* testsuite/27_io/basic_fstream/cons/char/path.cc (main):
	  Return a value for functions with non-void return type,
	  or change type to void, or add -Wno-return-type for test.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc (main):
	Likewise.
	* testsuite/27_io/basic_ofstream/open/char/path.cc (main):
	Likewise.

From-SVN: r254451
2017-11-06 13:41:35 +00:00
Paolo Carlini 98910bc2b9 deduction.cc: Avoid -Wreturn-type warnings.
2017-11-06  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/20_util/optional/cons/deduction.cc: Avoid -Wreturn-type
	warnings.
	* testsuite/20_util/pair/cons/deduction.cc: Likewise.
	* testsuite/20_util/pair/traits.cc: Likewise.
	* testsuite/20_util/tuple/cons/deduction.cc: Likewise.
	* testsuite/20_util/variant/compile.cc: Likewise.
	* testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise.
	* testsuite/23_containers/unordered_map/modifiers/try_emplace.cc:
	Likewise.

From-SVN: r254450
2017-11-06 12:55:35 +00:00
Jonathan Wakely e641ee437f Define std::endian for C++2a (P0463R1)
* include/std/type_traits (endian): Define new enumeration type.
	* testsuite/20_util/endian/1.cc: New test.

From-SVN: r254381
2017-11-03 15:45:49 +00:00
Jonathan Wakely 50e248f0c8 PR libstdc++/82777 fix path normalization for dot-dot
PR libstdc++/82777
	* src/filesystem/std-path.cc (path::lexically_normal): Remove dot-dot
	elements correctly.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Add testcase.
	* testsuite/util/testsuite_fs.h (compare_paths): Improve exception
	text.

From-SVN: r254317
2017-11-01 17:09:14 +00:00
Ville Voutilainen ccbbf8df05 Implement LWG 2485
* include/debug/array (get(const array<_Tp, _Nm>&&)): New.
* include/std/array (get(const array<_Tp, _Nm>&&)): Likewise.
* include/std/tuple (get(const tuple<_Elements...>&&)): Likewise.
(get(const tuple<_Types...>&&)): Likewise.
* include/std/utility
(__pair_get::__const_move_get(const std::pair<_Tp1, _Tp2>&&)):
Likewise.
(get(const std::pair<_Tp1, _Tp2>&&)): Likewise.
(get(const pair<_Tp, _Up>&&)): Likewise.
(get(const pair<_Up, _Tp>&&)): Likewise.
* testsuite/20_util/pair/astuple/get.cc: Add tests for
new overloads.
* testsuite/20_util/pair/astuple/get_by_type.cc: Likewise.
* testsuite/20_util/tuple/element_access/get2.cc: Likewise.
* testsuite/20_util/tuple/element_access/get2_by_type.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/get.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc:
Adjust.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Likewise.

From-SVN: r254222
2017-10-30 16:31:04 +02:00
Jonathan Wakely 9a3effa411 Make filesystem::file_status default constructor non-explicit (LWG 2787)
* include/bits/fs_dir.h (file_status): Make default constructor
	non-explicit (LWG 2787).
	* testsuite/27_io/filesystem/file_status/1.cc: New test.
	* testsuite/experimental/filesystem/file_status/1.cc: New test.

From-SVN: r254159
2017-10-27 18:49:21 +01:00
Jonathan Wakely d49f254a6c Provide filesystem::path overloads for file streams (LWG 2676, partial)
* include/std/fstream (basic_filebuf::_If_path): New SFINAE helper.
	(basic_filebuf::open<Path>(const Path&, const ios_base::openmode&))
	(basic_ifstream<Path>(const Path&, const ios_base::openmode&))
	(basic_ifstream::open<Path>(const Path&, const ios_base::openmode&))
	(basic_ofstream<Path>(const Path&, const ios_base::openmode&))
	(basic_ofstream::open<Path>(const Path&, const ios_base::openmode&))
	(basic_fstream<Path>(const Path&, const ios_base::openmode&))
	(basic_fstream::open<Path>(const Path&, const ios_base::openmode&)):
	New constructors and member functions.
	* testsuite/27_io/basic_filebuf/open/char/path.cc: New test.
	* testsuite/27_io/basic_fstream/cons/char/path.cc: New test.
	* testsuite/27_io/basic_fstream/open/char/path.cc: New test.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc: New test.
	* testsuite/27_io/basic_ifstream/open/char/path.cc: New test.
	* testsuite/27_io/basic_ofstream/cons/char/path.cc: New test.
	* testsuite/27_io/basic_ofstream/open/char/path.cc: New test.

From-SVN: r254148
2017-10-27 13:39:01 +01:00
Jonathan Wakely 0348dd008a Define std::filesystem::path::format enum (P0430R2)
* include/bits/fs_path.h (path::format): Define new enumeration type.
	(path(string_type&&), path<Source>(const Source&))
	(path<InputIterator>(InputIterator, InputIterator))
	(path<Source>(const Source&, const locale&))
	(path<InputIterator>(InputIterator, InputIterator, const locale&)):
	Add format parameter.
	* testsuite/27_io/filesystem/path/construct/format.cc: New test.

From-SVN: r254144
2017-10-27 13:01:49 +01:00
Jonathan Wakely d67be4437a Protect more algorithms from overloaded comma operators
* include/bits/stl_algo.h (__find_if_not_n, generate_n): Cast to void
	to ensure overloaded comma not used.
	* include/bits/stl_algobase.h (__fill_n_a, equal): Likewise.
	* include/bits/stl_uninitialized.h (__uninitialized_fill_n)
	(__uninitialized_fill_n_a, __uninitialized_default_n_1)
	(__uninitialized_default_n_a, __uninitialized_copy_n)
	(__uninitialized_copy_n_pair): Likewise
	* testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc:
	Use test iterator wrappers with overloaded comma operator.
	* testsuite/25_algorithms/fill_n/1.cc: Likewise.
	* testsuite/25_algorithms/generate_n/1.cc: New test.
	* testsuite/25_algorithms/stable_partition/1.cc: New test.
	* testsuite/util/testsuite_iterators.h (operator,): Add deleted
	non-member comma operator with iterator wrappers as right operand.

From-SVN: r254128
2017-10-27 00:50:40 +01:00
Ville Voutilainen 957f5feacf Deduction guides for associative containers, debug mode deduction guide fixes.
* include/bits/stl_iterator.h (__iter_key_t)
(__iter_val_t, __iter_to_alloc_t): New.
* include/bits/stl_map.h: Add deduction guides.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_set.h: Likewise.
* include/bits/unordered_map.h: Likewise.
* include/bits/unordered_set.h: Likewise.
* include/debug/deque: Likewise.
* include/debug/forward_list: Likewise.
* include/debug/list: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/set.h: Likewise.
* include/debug/unordered_map: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/vector: Likewise.
* testsuite/23_containers/map/cons/deduction.cc: New.
* testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
* testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
* testsuite/23_containers/set/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_multimap/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.

From-SVN: r254113
2017-10-26 19:42:31 +03:00
Jonathan Wakely eeb517d3e7 Fix filesystem::path::lexically_normal algorithm
* src/filesystem/std-path.cc (path::lexically_normal): Add missing
	step to algorithm, for removing dot-dot elements after root-directory.
	* testsuite/27_io/filesystem/operations/canonical.cc: Use
	compare_paths for more exhaustive checks.
	* testsuite/27_io/filesystem/operations/proximate.cc: Likewise.
	* testsuite/27_io/filesystem/path/append/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/concat/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/concat/strings.cc: Fix comment.
	* testsuite/27_io/filesystem/path/construct/locale.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Use
	compare_paths for more exhaustive checks. Add extra testcases.
	* testsuite/27_io/filesystem/path/generation/proximate.cc: Use
	compare_paths for more exhaustive checks.
	* testsuite/27_io/filesystem/path/generation/relative.cc: Likewise.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: Remove
	unused header.
	* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: Fix
	comment.
	* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc: Use
	compare_paths for more exhaustive checks.
	* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc:
	Likewise.
	* testsuite/util/testsuite_fs.h (compare_paths): Also compare native
	strings.

From-SVN: r254075
2017-10-25 13:42:53 +01:00
Jonathan Wakely e921c7e5a6 PR libstdc++/82706 fix test for case where operations succeed
PR libstdc++/82706
	* testsuite/27_io/filesystem/operations/permissions.cc: Fix test.

From-SVN: r254067
2017-10-25 01:27:10 +01:00
François Dumont 8468bfe8cb libstdc++.exp (check_v3_target_normal_mode): Add c++config.h include.
2017-10-24  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/lib/libstdc++.exp (check_v3_target_normal_mode): Add
	c++config.h include.
	(check_v3_target_normal_namespace): New.
	* testsuite/lib/dg-options.exp (dg-require-normal-namespace): New.
	* testsuite/18_support/headers/limits/synopsis.cc: Add latter.
	* testsuite/20_util/from_chars/requirements.cc: Likewise.
	* testsuite/20_util/headers/functional/synopsis.cc: Likewise.
	* testsuite/20_util/headers/memory/synopsis.cc: Likewise.
	* testsuite/20_util/headers/utility/synopsis.cc: Likewise.
	* testsuite/20_util/to_chars/requirements.cc: Likewise.
	* testsuite/21_strings/headers/string/synopsis.cc: Likewise.
	* testsuite/22_locale/headers/locale/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/bitset/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/deque/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/forward_list/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/list/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/map/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/queue/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/set/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/stack/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/vector/synopsis.cc: Likewise.
	* testsuite/23_containers/map/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/set/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++11.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++14.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++17.cc: Likewise.
	* testsuite/26_numerics/complex/abi_tag.cc: Likewise.
	* testsuite/26_numerics/headers/complex/synopsis.cc: Likewise.
	* testsuite/26_numerics/headers/valarray/synopsis.cc: Likewise.
	* testsuite/27_io/headers/fstream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/ios/synopsis.cc: Likewise.
	* testsuite/27_io/headers/istream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/ostream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/sstream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/streambuf/synopsis.cc: Likewise.

From-SVN: r254060
2017-10-24 20:20:12 +00:00
Jonathan Wakely 641cb5a675 Implement C++17 Filesystem library
Based on Filesystem TS implementation, with the changes applied by:

- P0219R1 Relative Paths for Filesystem
- P0317R1 Directory Entry Caching for Filesystem
- P0492R2 Resolution of C++17 National Body Comments

Where appropriate code is shared between the TS and C++17
implementations.

	* include/Makefile.am: Add new headers for C++17 filesystem library.
	* include/Makefile.in: Regenerate.
	* include/bits/fs_dir.h: New header, based on Filesystem TS code in
	include/experimental/bits directory.
	* include/bits/fs_fwd.h: Likewise.
	* include/bits/fs_ops.h: Likewise.
	* include/bits/fs_path.h: Likewise.
	* include/experimental/bits/fs_dir.h: Rename Doxygen group.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/filesystem (filesystem_error::_M_gen_what):
	Remove inline definition.
	* include/precompiled/stdc++.h: Add <filesystem> to precompiled
	header.
	* include/std/filesystem: New header.
	* python/libstdcxx/v6/printers.py: Enable printer for std::filesystem
	paths.
	* src/filesystem/Makefile.am: Add new files. Compile as C++17.
	* src/filesystem/Makefile.in: Regenerate.
	* src/filesystem/cow-dir.cc: Update comment.
	* src/filesystem/cow-ops.cc: Likewise.
	* src/filesystem/cow-path.cc: Likewise.
	* src/filesystem/cow-std-dir.cc: New file.
	* src/filesystem/cow-std-ops.cc: New file.
	* src/filesystem/cow-std-path.cc: New file.
	* src/filesystem/dir-common.h (_Dir_base, get_file_type): New header
	for common code.
	* src/filesystem/dir.cc (_Dir): Derive from _Dir_base.
	(open_dir): Move to _Dir_base constructor.
	(get_file_type): Move to dir-common.h.
	(recurse): Move to _Dir_base::should_recurse.
	* src/filesystem/ops-common.h: New header for common code.
	* src/filesystem/ops.cc (is_set, make_file_type, make_file_status)
	(is_not_found_errno, file_time, do_copy_file): Move to ops-common.h.
	* src/filesystem/path.cc (filesystem_error::_M_gen_what): Define.
	* src/filesystem/std-dir.cc: New file, based on Filesystem TS code.
	* src/filesystem/std-ops.cc: Likewise.
	* src/filesystem/std-dir.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc: New
	test.
	* testsuite/27_io/filesystem/iterators/pop.cc: New test.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	New test.
	* testsuite/27_io/filesystem/operations/absolute.cc: New test.
	* testsuite/27_io/filesystem/operations/canonical.cc: New test.
	* testsuite/27_io/filesystem/operations/copy.cc: New test.
	* testsuite/27_io/filesystem/operations/copy_file.cc: New test.
	* testsuite/27_io/filesystem/operations/create_directories.cc: New
	test.
	* testsuite/27_io/filesystem/operations/create_directory.cc: New test.
	* testsuite/27_io/filesystem/operations/create_symlink.cc: New test.
	* testsuite/27_io/filesystem/operations/current_path.cc: New test.
	* testsuite/27_io/filesystem/operations/equivalent.cc: New test.
	* testsuite/27_io/filesystem/operations/exists.cc: New test.
	* testsuite/27_io/filesystem/operations/file_size.cc: New test.
	* testsuite/27_io/filesystem/operations/is_empty.cc: New test.
	* testsuite/27_io/filesystem/operations/last_write_time.cc: New test.
	* testsuite/27_io/filesystem/operations/permissions.cc: New test.
	* testsuite/27_io/filesystem/operations/proximate.cc: New test.
	* testsuite/27_io/filesystem/operations/read_symlink.cc: New test.
	* testsuite/27_io/filesystem/operations/relative.cc: New test.
	* testsuite/27_io/filesystem/operations/remove_all.cc: New test.
	* testsuite/27_io/filesystem/operations/space.cc: New test.
	* testsuite/27_io/filesystem/operations/status.cc: New test.
	* testsuite/27_io/filesystem/operations/symlink_status.cc: New test.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc: New
	test.
	* testsuite/27_io/filesystem/operations/weakly_canonical.cc: New test.
	* testsuite/27_io/filesystem/path/append/path.cc: New test.
	* testsuite/27_io/filesystem/path/assign/assign.cc: New test.
	* testsuite/27_io/filesystem/path/assign/copy.cc: New test.
	* testsuite/27_io/filesystem/path/compare/compare.cc: New test.
	* testsuite/27_io/filesystem/path/compare/path.cc: New test.
	* testsuite/27_io/filesystem/path/compare/strings.cc: New test.
	* testsuite/27_io/filesystem/path/concat/path.cc: New test.
	* testsuite/27_io/filesystem/path/concat/strings.cc: New test.
	* testsuite/27_io/filesystem/path/construct/copy.cc: New test.
	* testsuite/27_io/filesystem/path/construct/default.cc: New test.
	* testsuite/27_io/filesystem/path/construct/locale.cc: New test.
	* testsuite/27_io/filesystem/path/construct/range.cc: New test.
	* testsuite/27_io/filesystem/path/construct/string_view.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/extension.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/filename.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/parent_path.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/relative_path.cc: New
	test.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc: New
	test.
	* testsuite/27_io/filesystem/path/decompose/root_name.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/root_path.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/stem.cc: New test.
	* testsuite/27_io/filesystem/path/generation/normal.cc: New test.
	* testsuite/27_io/filesystem/path/generation/proximate.cc: New test.
	* testsuite/27_io/filesystem/path/generation/relative.cc: New test.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: New test.
	* testsuite/27_io/filesystem/path/itr/traversal.cc: New test.
	* testsuite/27_io/filesystem/path/modifiers/clear.cc: New test.
	* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/swap.cc: New test.
	* testsuite/27_io/filesystem/path/native/string.cc: New test.
	* testsuite/27_io/filesystem/path/nonmember/hash_value.cc: New test.
	* testsuite/27_io/filesystem/path/query/empty.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_extension.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_filename.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_parent_path.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_relative_path.cc: New
	test.
	* testsuite/27_io/filesystem/path/query/has_root_directory.cc: New
	test.
	* testsuite/27_io/filesystem/path/query/has_root_name.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_root_path.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_stem.cc: New test.
	* testsuite/27_io/filesystem/path/query/is_relative.cc: New test.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Define USE_FILESYSTEM_TS.
	* testsuite/util/testsuite_fs.h: Allow use with C++17 paths as well
	as Filesystem TS.

From-SVN: r254008
2017-10-23 13:11:22 +01:00
Jonathan Wakely 908d1d3aea PR libstdc++/82644 document IS 29124 support
Also fix declarations of special functions in C++17, to import them into
the global namespace in <math.h>, and to prevent defining the
non-standard hypergeometric functions in strict mode.

	PR libstdc++/82644
	* doc/xml/manual/intro.xml: Include new section.
	* doc/xml/manual/status_cxxis29124.xml: New section on IS 29124
	status.
	* include/bits/specfun.h [__STRICT_ANSI__] (hyperg, hypergf, hypergl)
	(conf_hyperg, conf_hypergf, conf_hypergl): Don't declare.
	* include/c_compatibility/math.h: Import special functions into
	global namespace for C++17.
	* testsuite/26_numerics/headers/cmath/82644.cc: New test.
	* testsuite/26_numerics/headers/cmath/functions_global_c++17.cc: New
	test.

From-SVN: r254004
2017-10-23 12:10:28 +01:00
Jonathan Wakely dfdf2839b5 Fix invalid path::iterator test
* testsuite/experimental/filesystem/path/itr/traversal.cc: Do not
	increment past-the-end iterators.

From-SVN: r253967
2017-10-21 02:16:43 +01:00
Jonathan Wakely 233fa165ad Update value of __cpp_lib_chrono feature-test macro
* include/std/chrono (__cpp_lib_chrono): Update macro value to
	indicate support for P0505R0.
	* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Check
	for updated macro.

From-SVN: r253959
2017-10-20 22:05:11 +01:00
Jonathan Wakely 253e8d2150 Define __cpp_lib_byte feature-test macro
* include/c_global/cstddef: Define __cpp_lib_byte feature-test macro.
	* testsuite/18_support/byte/requirements.cc: Check macro.

From-SVN: r253952
2017-10-20 19:02:19 +01:00
Jonathan Wakely db62ad7c66 Improve tests for error reporting in Filesystem TS
* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Ensure that error_code arguments are
	cleared when required.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Remove redundant check.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Ensure that error_code argument is cleared when required.

From-SVN: r253897
2017-10-19 14:57:10 +01:00
Jonathan Wakely 551124d561 Fix path::iterator post-increment and post-decrement
* include/experimental/bits/fs_path.h (path::iterator++(int))
	(path::iterator--(int)): Fix for paths with only one component.
	* testsuite/experimental/filesystem/path/itr/traversal.cc: Test
	post-increment and post-decrement.

From-SVN: r253896
2017-10-19 14:57:06 +01:00
Jonathan Wakely af23b26ab0 Use __LONG_LONG_MAX__ instead of LONG_LONG_MAX in test
* testsuite/decimal/conversion-to-integral.cc: Use predefined macro
	instead of non-standard glibc one.

From-SVN: r253894
2017-10-19 14:56:55 +01:00
François Dumont 1be043a140 re PR libstdc++/82558 (V8 JavaScript engine segfaults since r249235)
2017-10-16  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/82558
	* include/bits/stl_bvector.h (fill): Add iterator offset check.
	* testsuite/23_containers/vector/bool/82558.cc: New.

From-SVN: r253776
2017-10-16 05:44:03 +00:00
Jonathan Wakely 3b0dd4fea2 PR libstdc++/82522 overload map insert functions for rvalues (LWG 2354)
PR libstdc++/82522
	* doc/xml/manual/intro.xml: Document LWG 2354 changes.
	* include/bits/stl_map.h (map::insert(value_type&&))
	(map::insert(const_iterator, value_type&&)): Add overload for rvalues.
	* include/bits/stl_multimap.h (multimap::insert(value_type&&))
	(multimap::insert(const_iterator, value_type&&)): Likewise.
	* include/bits/unordered_map.h (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: New test.
	* testsuite/23_containers/multimap/modifiers/insert/dr2354.cc: New
	test.
	* testsuite/23_containers/unordered_map/insert/dr2354.cc: New test.
	* testsuite/23_containers/unordered_multimap/insert/dr2354.cc: New
	test.

From-SVN: r253725
2017-10-13 13:39:32 +01:00
Jonathan Wakely 5d2b807526 PR libstdc++/82417 do not include C99 <complex.h> in strict modes
As an extension the C++ version of <complex.h> includes the C version,
but that defines macros with non-reserved names that should not be
defined in ISO C++. Only include the C header for non-strict modes, or
for pre-C++11 (because C++98 doesn't mention <complex.h> at all).

	PR libstdc++/59087
	PR libstdc++/82417
	* include/c_compatibility/complex.h [!C++98 && __STRICT_ANSI__]: Do
	not include C library's <complex.h>.
	* testsuite/26_numerics/complex/c99.cc: Depend on __STRICT_ANSI__.
	* testsuite/26_numerics/headers/complex.h/std_c++11.h: New test.
	* testsuite/26_numerics/headers/complex.h/std_gnu++11.h: New test.
	* testsuite/26_numerics/headers/complex.h/std_c++98.h: New test.

From-SVN: r253581
2017-10-10 12:25:45 +01:00
Jonathan Wakely e58683fb9f Fix new testsuite failure on newlib targets
* testsuite/20_util/to_chars/1.cc: Add dg-require-string-conversions.

From-SVN: r253463
2017-10-05 21:26:08 +01:00
Petr Ovtchenkov 4e91452412 2017-10-04 Petr Ovtchenkov <ptr@void-ptr.info>
François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/streambuf_iterator.h
	(istreambuf_iterator<>::operator*()): Do not capture iterator state
	in Debug assertion.
	(istreambuf_iterator<>::operator++()): Likewise and remove _M_sbuf check.
	(istreambuf_iterator<>::operator++(int)): Likewise.
	(istreambuf_iterator<>::_M_get()): Remove _M_c assignment.
	(istreambuf_iterator<>::_S_is_eof()): New.
	(istreambuf_iterator<>::_M_at_eof()): Adapt, use latter.
	(find(istreambuf_iterator<>, istreambuf_iterator<>, _CharT)):
	Return an iterator with _M_c set to eof to capture streambuf state
	on evaluation.
	(testsuite/24_iterators/istreambuf_iterator/2.cc): Add checks.

Co-Authored-By: François Dumont <fdumont@gcc.gnu.org>

From-SVN: r253417
2017-10-04 16:15:18 +00:00
Jonathan Wakely 804b7cc438 C++17 P0067R5 std::to_chars and std::from_chars (partial)
This adds the integral overloads of std::to_chars and std::from_chars,
including the changes made by P0682R0. Support for floating point types
is absent.

	* include/Makefile.am: Add new <charconv> header.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Include <charconv>.
	* include/std/charconv: New file.
	(to_chars_result, to_chars, from_chars_result, from_chars): Define.
	* testsuite/20_util/from_chars/1.cc: New test.
	* testsuite/20_util/from_chars/1_neg.cc: New test.
	* testsuite/20_util/from_chars/2.cc: New test.
	* testsuite/20_util/from_chars/requirements.cc: New test.
	* testsuite/20_util/to_chars/1.cc: New test.
	* testsuite/20_util/to_chars/1_neg.cc: New test.
	* testsuite/20_util/to_chars/2.cc: New test.
	* testsuite/20_util/to_chars/requirements.cc: New test.

From-SVN: r253353
2017-10-02 15:06:40 +01:00
François Dumont c320262396 22131.cc: Make test less istreambuf_iterator implementation dependent.
2017-09-27  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/22_locale/money_get/get/char/22131.cc: Make test less
	istreambuf_iterator implementation dependent.
	* testsuite/22_locale/money_get/get/wchar_t/22131.cc: Likewise.

From-SVN: r253237
2017-09-27 20:16:43 +00:00
Jonathan Wakely f3f08c3f03 Fix tests for std::clamp
* testsuite/25_algorithms/clamp/1.cc: Fix order of arguments and
	expected results when using predicate defining reverse order.
	* testsuite/25_algorithms/clamp/constexpr.cc: Likewise.

From-SVN: r253051
2017-09-21 10:59:55 +01:00
Jonathan Wakely 4cf5930fdc PR libstdc++/79162 Fix std::string regression due to LWG 2946
PR libstdc++/79162
	* include/bits/basic_string.h (basic_string::_If_sv): Remove from the
	overload set when the argument is derived from basic_string.
	* testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc: New
	test.
	* testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc:
	New test.

From-SVN: r253024
2017-09-20 18:59:50 +01:00
Jonathan Wakely e18f68c715 Fix failing C++17 test
* testsuite/24_iterators/range_access_cpp17.cc: Fix order of dg-do
	and dg-options directives. Fix invalid test.

From-SVN: r253019
2017-09-20 17:34:53 +01:00
Jonathan Wakely 95ed529d34 PR libstdc++/81469 deprecate std::uncaught_exception for C++17
PR libstdc++/81469
	* libsupc++/exception (uncaught_exception): Deprecate for C++17.
	* testsuite/18_support/exception_ptr/62258.cc: Add -Wno-deprecated.
	* testsuite/18_support/uncaught_exception/14026.cc: Likewise.

From-SVN: r253018
2017-09-20 17:34:49 +01:00
Jonathan Wakely f6b05c44aa PR libstdc++/82262 fix std::hash<std::optional<const T>>
PR libstdc++/82262
	* include/std/optional (__optional_hash_call_base): Add template
	parameter for remove_const_t<_Tp> and use it consistently.
	* testsuite/20_util/optional/hash.cc: Test optional<const T>.

From-SVN: r253010
2017-09-20 14:24:45 +01:00
Jonathan Wakely 23b49089a4 PR libstdc++/71500 restore C++11 compatibility in <regex>
PR libstdc++/71500
	* include/bits/regex_executor.tcc
	(_Backref_matcher<BidIt, regex_traits<C>>::_M_apply): Use
	std::__equal4 instead of C++14 4-iterator overloads of std::equal.
	* include/bits/stl_algobase.h (__equal4): New functions implementing
	4-iterator overloads of std::equal for use in C++11.
	(equal(It1, It1, It2, It2), equal(It1, It1, It2, It2, BinaryPred)):
	Move function bodies to new __equal4 functions.
	* testsuite/28_regex/simple_c++11.cc: New.

From-SVN: r252981
2017-09-19 18:06:12 +01:00
Jonathan Wakely c4b06e7f1d PR libstdc++/82254 fix std::is_nothrow_invocable_r w.r.t throwing conversions
PR libstdc++/82254
	* include/std/type_traits (__is_invocable): Add partial specialization
	for INVOKE<void> case and remove is_void<R> check from partial
	specialization for INVOKE<R> case.
	(__is_nt_invocable_impl): New helper for is_nothrow_invocable_r.
	(is_nothrow_invocable_r): Use __is_nt_invocable_impl.
	* testsuite/20_util/is_nothrow_invocable/value.cc: Add tests for
	conversions that can throw or fail to convert. Use static assert
	strings to explain negative results.
	* testsuite/20_util/is_nothrow_invocable/value_ext.cc: Use
	is_nothrow_constructible in is_nt_invocable_conv.

From-SVN: r252977
2017-09-19 15:33:51 +01:00
Jonathan Wakely e1227692dd PR libstdc++/81468 fix test for duration conversions
PR libstdc++/81468
	* testsuite/20_util/duration/cons/dr1177.cc: Fix incorrect test and
	improve static assertion messages.

From-SVN: r252950
2017-09-18 21:00:32 +01:00
Jonathan Wakely ec26ff5a01 PR libstdc++/71187 reimplement declval without add_rvalue_reference
PR libstdc++/71187
	* include/std/type_traits (__declval): New function to deduce return
	type of declval.
	(__declval_protector::_delegate): Remove.
	(declval): Use __declval instead of add_rvalue_reference and
	__declval_protector::__delegate.
	* testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error
	lineno.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
	Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.

From-SVN: r252922
2017-09-18 12:40:10 +01:00
Jakub Jelinek 7b9361409d invoke.texi: Document -std=c++17 and -std=gnu++17 and document c++1z and gnu++1z as deprecated.
* doc/invoke.texi: Document -std=c++17 and -std=gnu++17 and document
	c++1z and gnu++1z as deprecated.  Change other references to
	-std=c++1z to -std=c++17 and -std=gnu++1z to -std=gnu++17.
	Change -Wc++1z-compat to -Wc++17-compat.
	* doc/cpp.texi: Document -std=c++17 defines __cplusplus 201703L.
	* dwarf2out.c (highest_c_language): Handle C++17.
	(gen_compile_unit_die): Likewise.
c-family/
	* c.opt (Wc++1z-compat): Change from option to undocumented alias.
	(Wc++17-compat): Change from undocumented alias to option.
	(Wnoexcept-type): Enable by Wc++17-compat instead of Wc++1z-compat,
	change C++1z to C++17 in description.
	(std=c++1z, std=gnu++1z): Change from option to undocumented
	deprecated alias.
	(std=c++17, std=gnu++17): Change from undocumented alias to option.
	Adjust description.
	* c-common.h (enum cxx_dialect): Rename cxx1z to cxx17.
	* c-opts.c (set_std_cxx1z): Rename to ...
	(set_std_cxx17): ... this.
	(c_common_handle_option): Rename OPT_std_c__1z to OPT_std_c__17
	and OPT_std_gnu__1z to OPT_std_gnu__17.  Adjust set_std_cxx1z
	caller.  
	(c_common_post_options): Use cxx17 instead of cxx1z.  Adjust
	comments.
cp/
	* decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
	adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
	to C++17 or -std=gnu++17 or -std=c++17.  Adjust comments.
	(cxx_init_decl_processing, next_initializable_field,
	is_direct_enum_init, check_initializer, cp_finish_decl,
	mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
	finish_function): Likewise.
	* cp-tree.h (DECL_INLINE_VAR_P): Likewise.
	* pt.c (mark_template_parm, convert_nontype_argument,
	instantiate_class_template_1, type_unification_real, unify,
	get_partial_spec_bindings, dependent_type_p_r): Likewise.
	* typeck.c (cp_build_unary_op): Likewise.
	* constexpr.c (var_in_maybe_constexpr_fn): Likewise.
	* call.c (build_user_type_conversion_1, build_over_call,
	build_special_member_call): Likewise.
	* lambda.c (begin_lambda_type): Likewise.
	* typeck2.c (process_init_constructor_record): Likewise.
	* class.c (build_base_field, finalize_literal_type_property,
	explain_non_literal_class): Likewise.
	* parser.c (cp_parser_diagnose_invalid_type_name,
	cp_parser_primary_expression, cp_parser_lambda_introducer,
	cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
	cp_convert_range_for, cp_parser_perform_range_for_lookup,
	cp_parser_decomposition_declaration, cp_parser_linkage_specification,
	cp_parser_static_assert, cp_parser_simple_type_specifier,
	cp_parser_namespace_definition, cp_parser_using_declaration,
	cp_parser_init_declarator, cp_parser_type_parameter_key,
	cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
	cp_parser_constructor_declarator_p): Likewise.
	* mangle.c (struct globals): Rename need_cxx1z_warning to
	need_cxx17_warning.
	(write_exception_spec, start_mangling, mangle_decl): Likewise.
	* Make-lang.in (check-c++1z): Rename to check-c++17, depend on
	it.
	(check-c++17): New goal.  Use 17 instead of 1z.
	(check-c++-all): Use 17 instead of 1z.
testsuite/
	* lib/g++-dg.exp (g++-dg-runtest): Use 17 instead of 1z.
	* lib/target-supports.exp (check_effective_target_c++14): Use
	check_effective_target_c++17 instead of check_effective_target_c++1z.
	(check_effective_target_c++14_down): Likewise.
	(check_effective_target_c++1z_only): Rename to ...
	(check_effective_target_c++17_only): ... this.
	(check_effective_target_c++1z): Rename to ...
	(check_effective_target_c++17): ... this.
	* g++.dg/debug/dwarf2/inline-var-1.C: Use -std=c++17 or -std=gnu++17
	instead of -std=c++1z or -std=gnu++1z.  Use c++17 instead of c++1z
	and c++17_only instead of c++1z_only.  Adjust expected diagnostics
	and comments refering to 1z to 17.
	* g++.dg/debug/dwarf2/inline-var-2.C: Likewise.
	* g++.dg/template/partial5.C: Likewise.
	* g++.dg/template/nontype8.C: Likewise.
	* g++.dg/cpp1z/noexcept-type5.C: Likewise.
	* g++.dg/cpp1z/nontype3a.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda4.C: Likewise.
	* g++.dg/cpp1z/noexcept-type16.C: Likewise.
	* g++.dg/cpp1z/class-deduction32.C: Likewise.
	* g++.dg/cpp1z/pr78771.C: Likewise.
	* g++.dg/cpp1z/elide1.C: Likewise.
	* g++.dg/cpp1z/fold3.C: Likewise.
	* g++.dg/cpp1z/class-deduction2.C: Likewise.
	* g++.dg/cpp1z/noexcept-type12.C: Likewise.
	* g++.dg/cpp1z/inline-var2.C: Likewise.
	* g++.dg/cpp1z/eval-order2.C: Likewise.
	* g++.dg/cpp1z/decomp21.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda11.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda9.C: Likewise.
	* g++.dg/cpp1z/utf8-neg.C: Likewise.
	* g++.dg/cpp1z/class-deduction41.C: Likewise.
	* g++.dg/cpp1z/class-deduction23.C: Likewise.
	* g++.dg/cpp1z/nodiscard3.C: Likewise.
	* g++.dg/cpp1z/static_assert-nomsg.C: Likewise.
	* g++.dg/cpp1z/noexcept-type9.C: Likewise.
	* g++.dg/cpp1z/class-deduction21.C: Likewise.
	* g++.dg/cpp1z/range-for1.C: Likewise.
	* g++.dg/cpp1z/init-statement4.C: Likewise.
	* g++.dg/cpp1z/udlit-utf8char.C: Likewise.
	* g++.dg/cpp1z/decomp30.C: Likewise.
	* g++.dg/cpp1z/class-deduction39.C: Likewise.
	* g++.dg/cpp1z/register2.C: Likewise.
	* g++.dg/cpp1z/decomp9.C: Likewise.
	* g++.dg/cpp1z/regress1.C: Likewise.
	* g++.dg/cpp1z/direct-enum-init1.C: Likewise.
	* g++.dg/cpp1z/class-deduction30.C: Likewise.
	* g++.dg/cpp1z/abbrev2.C: Likewise.
	* g++.dg/cpp1z/nontype-auto6.C: Likewise.
	* g++.dg/cpp1z/regress2.C: Likewise.
	* g++.dg/cpp1z/decomp16.C: Likewise.
	* g++.dg/cpp1z/bool-increment1.C: Likewise.
	* g++.dg/cpp1z/aligned-new1.C: Likewise.
	* g++.dg/cpp1z/decomp3.C: Likewise.
	* g++.dg/cpp1z/register1.C: Likewise.
	* g++.dg/cpp1z/namespace-attribs.C: Likewise.
	* g++.dg/cpp1z/class-deduction1.C: Likewise.
	* g++.dg/cpp1z/decomp10.C: Likewise.
	* g++.dg/cpp1z/constexpr-if11.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda10.C: Likewise.
	* g++.dg/cpp1z/decomp27.C: Likewise.
	* g++.dg/cpp1z/noexcept-type2.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda6.C: Likewise.
	* g++.dg/cpp1z/class-deduction9.C: Likewise.
	* g++.dg/cpp1z/attributes-enum-1.C: Likewise.
	* g++.dg/cpp1z/decomp11.C: Likewise.
	* g++.dg/cpp1z/aligned-new3.C: Likewise.
	* g++.dg/cpp1z/utf8-2.C: Likewise.
	* g++.dg/cpp1z/lambda-this3.C: Likewise.
	* g++.dg/cpp1z/decomp-constexpr1.C: Likewise.
	* g++.dg/cpp1z/byte1.C: Likewise.
	* g++.dg/cpp1z/nontype-auto9.C: Likewise.
	* g++.dg/cpp1z/aggr-base4.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda1.C: Likewise.
	* g++.dg/cpp1z/nontype-auto3.C: Likewise.
	* g++.dg/cpp1z/utf8-2a.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda7.C: Likewise.
	* g++.dg/cpp1z/aggr-base6.C: Likewise.
	* g++.dg/cpp1z/cplusplus.C: Likewise.
	* g++.dg/cpp1z/class-deduction20.C: Likewise.
	* g++.dg/cpp1z/aggr-base2.C: Likewise.
	* g++.dg/cpp1z/class-deduction6.C: Likewise.
	* g++.dg/cpp1z/noexcept-type3.C: Likewise.
	* g++.dg/cpp1z/class-deduction31.C: Likewise.
	* g++.dg/cpp1z/class-deduction25.C: Likewise.
	* g++.dg/cpp1z/class-deduction18.C: Likewise.
	* g++.dg/cpp1z/fold9.C: Likewise.
	* g++.dg/cpp1z/noexcept-type8.C: Likewise.
	* g++.dg/cpp1z/abbrev1.C: Likewise.
	* g++.dg/cpp1z/constexpr-if10.C: Likewise.
	* g++.dg/cpp1z/utf8.C: Likewise.
	* g++.dg/cpp1z/noexcept-type7.C: Likewise.
	* g++.dg/cpp1z/aggr-base3.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda8.C: Likewise.
	* g++.dg/cpp1z/init-statement2.C: Likewise.
	* g++.dg/cpp1z/nontype-auto4.C: Likewise.
	* g++.dg/cpp1z/constexpr-if12.C: Likewise.
	* g++.dg/cpp1z/class-deduction40.C: Likewise.
	* g++.dg/cpp1z/nontype3.C: Likewise.
	* g++.dg/cpp1z/class-deduction14.C: Likewise.
	* g++.dg/cpp1z/fold7.C: Likewise.
	* g++.dg/cpp1z/nontype2.C: Likewise.
	* g++.dg/cpp1z/class-deduction15.C: Likewise.
	* g++.dg/cpp1z/nested-namespace-def1.C: Likewise.
	* g++.dg/cpp1z/class-deduction13.C: Likewise.
	* g++.dg/cpp1z/aligned-new7.C: Likewise.
	* g++.dg/cpp1z/noexcept-type1.C: Likewise.
	* g++.dg/cpp1z/nontype1.C: Likewise.
	* g++.dg/cpp1z/init-statement5.C: Likewise.
	* g++.dg/cpp1z/nontype-auto2.C: Likewise.
	* g++.dg/cpp1z/decomp17.C: Likewise.
	* g++.dg/cpp1z/fold4.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda2.C: Likewise.
	* g++.dg/cpp1z/fold7a.C: Likewise.
	* g++.dg/cpp1z/nontype-auto5.C: Likewise.
	* g++.dg/cpp1z/init-statement7.C: Likewise.
	* g++.dg/cpp1z/aggr-base5.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda5.C: Likewise.
	* g++.dg/cpp1z/pr79143.C: Likewise.
	* g++.dg/cpp1z/class-deduction38.C: Likewise.
	* g++.dg/cpp1z/nontype-auto8.C: Likewise.
	* g++.dg/cpp1z/class-deduction12.C: Likewise.
	* g++.dg/cpp1z/decomp20.C: Likewise.
	* g++.dg/cpp1z/class-deduction22.C: Likewise.
	* g++.dg/cpp1z/class-deduction29.C: Likewise.
	* g++.dg/cpp1z/class-deduction8.C: Likewise.
	* g++.dg/cpp1z/class-deduction43.C: Likewise.
	* g++.dg/cpp1z/feat-cxx1z.C: Likewise.
	* g++.dg/cpp1z/fold8.C: Likewise.
	* g++.dg/cpp1z/init-statement3.C: Likewise.
	* g++.dg/cpp1z/nontype-auto10.C: Likewise.
	* g++.dg/cpp1z/class-deduction36.C: Likewise.
	* g++.dg/cpp1z/noexcept-type17.C: Likewise.
	* g++.dg/cpp1z/fallthrough1.C: Likewise.
	* g++.dg/cpp1z/fold1.C: Likewise.
	* g++.dg/cpp1z/class-deduction26.C: Likewise.
	* g++.dg/cpp1z/fold-ice1.C: Likewise.
	* g++.dg/cpp1z/fold5.C: Likewise.
	* g++.dg/cpp1z/class-deduction34.C: Likewise.
	* g++.dg/cpp1z/noexcept-type6.C: Likewise.
	* g++.dg/cpp1z/class-deduction7.C: Likewise.
	* g++.dg/cpp1z/class-deduction16.C: Likewise.
	* g++.dg/cpp1z/class-deduction10.C: Likewise.
	* g++.dg/cpp1z/eval-order3.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda13.C: Likewise.
	* g++.dg/cpp1z/aggr-base2a.C: Likewise.
	* g++.dg/cpp1z/nontype-auto1.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda3.C: Likewise.
	* g++.dg/cpp1z/nontype-auto7.C: Likewise.
	* g++.dg/cpp1z/decomp15.C: Likewise.
	* g++.dg/cpp1z/noexcept-type4.C: Likewise.
	* g++.dg/cpp1z/fold-mangle.C: Likewise.
	* g++.dg/cpp1z/class-deduction35.C: Likewise.
	* g++.dg/cpp1z/decomp4.C: Likewise.
	* g++.dg/cpp1z/class-deduction42.C: Likewise.
	* g++.dg/cpp1z/init-statement8.C: Likewise.
	* g++.dg/cpp1z/inline-var1a.C: Likewise.
	* g++.dg/cpp1z/init-statement6.C: Likewise.
	* g++.dg/cpp1z/class-deduction17.C: Likewise.
	* g++.dg/cpp1z/class-deduction28.C: Likewise.
	* g++.dg/cpp1z/class-deduction27.C: Likewise.
	* g++.dg/cpp1z/decomp-bitfield1.C: Likewise.
	* g++.dg/cpp1z/attributes-enum-1a.C: Likewise.
	* g++.dg/cpp1z/class-deduction11.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda12.C: Likewise.
	* g++.dg/cpp1z/init-statement9.C: Likewise.
	* g++.dg/cpp1z/class-deduction19.C: Likewise.
	* g++.dg/cpp1z/class-deduction5.C: Likewise.
	* g++.dg/cpp1z/fold2.C: Likewise.
	* g++.dg/cpp1z/class-deduction33.C: Likewise.
	* g++.dg/cpp1z/class-deduction24.C: Likewise.
	* g++.dg/cpp1z/aggr-base1.C: Likewise.
	* g++.dg/cpp1z/fold6.C: Likewise.
	* g++.dg/cpp1z/decomp12.C: Likewise.
	* g++.dg/cpp1z/class-deduction4.C: Likewise.
	* g++.dg/cpp1z/inline-var1.C: Likewise.
	* g++.dg/cpp1z/aligned-new2.C: Likewise.
	* g++.dg/cpp1z/class-deduction3.C: Likewise.
	* g++.dg/other/error3.C: Likewise.
	* g++.dg/init/new25.C: Likewise.
	* g++.dg/init/new13.C: Likewise.
	* g++.dg/tls/diag-2.C: Likewise.
	* g++.dg/tls/diag-4.C: Likewise.
	* g++.dg/opt/noreturn-1.C: Likewise.
	* g++.dg/eh/async-unwind2.C: Likewise.
	* g++.dg/eh/spec9.C: Likewise.
	* g++.dg/eh/spec7.C: Likewise.
	* g++.dg/eh/template1.C: Likewise.
	* g++.dg/eh/cond4.C: Likewise.
	* g++.dg/eh/pr41819.C: Likewise.
	* g++.dg/eh/delete1.C: Likewise.
	* g++.dg/eh/spec3.C: Likewise.
	* g++.dg/eh/forced4.C: Likewise.
	* g++.dg/eh/spec2.C: Likewise.
	* g++.dg/eh/shadow1.C: Likewise.
	* g++.dg/eh/pr38662.C: Likewise.
	* g++.dg/eh/ehopt1.C: Likewise.
	* g++.dg/eh/spec8.C: Likewise.
	* g++.dg/eh/init-temp2.C: Likewise.
	* g++.dg/rtti/crash3.C: Likewise.
	* g++.dg/warn/Wreturn-type-3.C: Likewise.
	* g++.dg/warn/register-parm-1.C: Likewise.
	* g++.dg/warn/register-var-2.C: Likewise.
	* g++.dg/gcov/gcov-7.C: Likewise.
	* g++.dg/tree-ssa/pr45605.C: Likewise.
	* g++.dg/cpp/pr23827_cxx98_neg.C: Likewise.
	* g++.dg/lookup/exception1.C: Likewise.
	* g++.dg/ubsan/pr79589.C: Likewise.
	* g++.dg/tm/pr47340.C: Likewise.
	* g++.dg/tm/pr46567.C: Likewise.
	* g++.dg/expr/bitfield5.C: Likewise.
	* g++.dg/expr/bool1.C: Likewise.
	* g++.dg/expr/lval3.C: Likewise.
	* g++.dg/expr/lval4.C: Likewise.
	* g++.dg/expr/bitfield4.C: Likewise.
	* g++.dg/expr/bitfield6.C: Likewise.
	* g++.dg/expr/bool3.C: Likewise.
	* g++.dg/ext/has_nothrow_constructor.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-7.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-1.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-2.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-4.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-5.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-6.C: Likewise.
	* g++.dg/ext/has_nothrow_assign.C: Likewise.
	* g++.dg/parse/register1.C: Likewise.
	* g++.dg/parse/error15.C: Likewise.
	* g++.dg/parse/linkage2.C: Likewise.
	* g++.dg/concepts/intro2.C: Likewise.
	* g++.dg/concepts/class.C: Likewise.
	* g++.dg/concepts/traits1.C: Likewise.
	* g++.dg/concepts/req5.C: Likewise.
	* g++.dg/concepts/var-concept5.C: Likewise.
	* g++.dg/concepts/fn-concept2.C: Likewise.
	* g++.dg/concepts/traits2.C: Likewise.
	* g++.dg/concepts/placeholder2.C: Likewise.
	* g++.dg/concepts/class6.C: Likewise.
	* g++.dg/concepts/memtmpl1.C: Likewise.
	* g++.dg/concepts/friend2.C: Likewise.
	* g++.dg/concepts/template-parm3.C: Likewise.
	* g++.dg/concepts/template-parm10.C: Likewise.
	* g++.dg/concepts/explicit-spec1.C: Likewise.
	* g++.dg/concepts/explicit-spec3.C: Likewise.
	* g++.dg/concepts/var-templ2.C: Likewise.
	* g++.dg/concepts/intro5.C: Likewise.
	* g++.dg/concepts/deduction-constraint1.C: Likewise.
	* g++.dg/concepts/iconv1.C: Likewise.
	* g++.dg/concepts/constrained-parm.C: Likewise.
	* g++.dg/concepts/template-template-parm1.C: Likewise.
	* g++.dg/concepts/var-concept3.C: Likewise.
	* g++.dg/concepts/class3.C: Likewise.
	* g++.dg/concepts/memfun2.C: Likewise.
	* g++.dg/concepts/req1.C: Likewise.
	* g++.dg/concepts/disjunction1.C: Likewise.
	* g++.dg/concepts/req17.C: Likewise.
	* g++.dg/concepts/pr65848.C: Likewise.
	* g++.dg/concepts/placeholder4.C: Likewise.
	* g++.dg/concepts/decl-diagnose.C: Likewise.
	* g++.dg/concepts/intro7.C: Likewise.
	* g++.dg/concepts/pr68683.C: Likewise.
	* g++.dg/concepts/partial-spec4.C: Likewise.
	* g++.dg/concepts/template-parm5.C: Likewise.
	* g++.dg/concepts/explicit-inst1.C: Likewise.
	* g++.dg/concepts/class-deduction1.C: Likewise.
	* g++.dg/concepts/class1.C: Likewise.
	* g++.dg/concepts/req15.C: Likewise.
	* g++.dg/concepts/memfun.C: Likewise.
	* g++.dg/concepts/pr68434.C: Likewise.
	* g++.dg/concepts/inherit-ctor4.C: Likewise.
	* g++.dg/concepts/partial-spec6.C: Likewise.
	* g++.dg/concepts/var-templ1.C: Likewise.
	* g++.dg/concepts/template-parm8.C: Likewise.
	* g++.dg/concepts/explicit-inst3.C: Likewise.
	* g++.dg/concepts/class4.C: Likewise.
	* g++.dg/concepts/req6.C: Likewise.
	* g++.dg/concepts/fn8.C: Likewise.
	* g++.dg/concepts/class5.C: Likewise.
	* g++.dg/concepts/placeholder5.C: Likewise.
	* g++.dg/concepts/req16.C: Likewise.
	* g++.dg/concepts/req10.C: Likewise.
	* g++.dg/concepts/var-concept2.C: Likewise.
	* g++.dg/concepts/auto3.C: Likewise.
	* g++.dg/concepts/generic-fn-err.C: Likewise.
	* g++.dg/concepts/pr65552.C: Likewise.
	* g++.dg/concepts/partial-concept-id2.C: Likewise.
	* g++.dg/concepts/fn1.C: Likewise.
	* g++.dg/concepts/partial-spec.C: Likewise.
	* g++.dg/concepts/template-parm12.C: Likewise.
	* g++.dg/concepts/diagnostic1.C: Likewise.
	* g++.dg/concepts/intro1.C: Likewise.
	* g++.dg/concepts/explicit-inst4.C: Likewise.
	* g++.dg/concepts/req18.C: Likewise.
	* g++.dg/concepts/explicit-spec5.C: Likewise.
	* g++.dg/concepts/var-concept6.C: Likewise.
	* g++.dg/concepts/fn9.C: Likewise.
	* g++.dg/concepts/req2.C: Likewise.
	* g++.dg/concepts/template-parm7.C: Likewise.
	* g++.dg/concepts/req14.C: Likewise.
	* g++.dg/concepts/template-parm6.C: Likewise.
	* g++.dg/concepts/variadic4.C: Likewise.
	* g++.dg/concepts/fn6.C: Likewise.
	* g++.dg/concepts/req-neg1.C: Likewise.
	* g++.dg/concepts/alias3.C: Likewise.
	* g++.dg/concepts/expression2.C: Likewise.
	* g++.dg/concepts/partial-spec3.C: Likewise.
	* g++.dg/concepts/expression3.C: Likewise.
	* g++.dg/concepts/memfun-err.C: Likewise.
	* g++.dg/concepts/pr66091.C: Likewise.
	* g++.dg/concepts/explicit-spec2.C: Likewise.
	* g++.dg/concepts/equiv.C: Likewise.
	* g++.dg/concepts/friend1.C: Likewise.
	* g++.dg/concepts/fn4.C: Likewise.
	* g++.dg/concepts/var-templ3.C: Likewise.
	* g++.dg/concepts/explicit-inst2.C: Likewise.
	* g++.dg/concepts/alias2.C: Likewise.
	* g++.dg/concepts/regress/alias-decl-42.C: Likewise.
	* g++.dg/concepts/placeholder6.C: Likewise.
	* g++.dg/concepts/fn10.C: Likewise.
	* g++.dg/concepts/req3.C: Likewise.
	* g++.dg/concepts/variadic2.C: Likewise.
	* g++.dg/concepts/pr65636.C: Likewise.
	* g++.dg/concepts/intro6.C: Likewise.
	* g++.dg/concepts/class2.C: Likewise.
	* g++.dg/concepts/fn2.C: Likewise.
	* g++.dg/concepts/req20.C: Likewise.
	* g++.dg/concepts/req8.C: Likewise.
	* g++.dg/concepts/placeholder1.C: Likewise.
	* g++.dg/concepts/pr65854.C: Likewise.
	* g++.dg/concepts/member-concept.C: Likewise.
	* g++.dg/concepts/template-parm2.C: Likewise.
	* g++.dg/concepts/variadic1.C: Likewise.
	* g++.dg/concepts/fn7.C: Likewise.
	* g++.dg/concepts/intro4.C: Likewise.
	* g++.dg/concepts/req13.C: Likewise.
	* g++.dg/concepts/inherit-ctor3.C: Likewise.
	* g++.dg/concepts/explicit-spec6.C: Likewise.
	* g++.dg/concepts/auto1.C: Likewise.
	* g++.dg/concepts/alias1.C: Likewise.
	* g++.dg/concepts/fn-concept1.C: Likewise.
	* g++.dg/concepts/template-parm11.C: Likewise.
	* g++.dg/concepts/explicit-spec4.C: Likewise.
	* g++.dg/concepts/partial-concept-id1.C: Likewise.
	* g++.dg/concepts/req9.C: Likewise.
	* g++.dg/concepts/req4.C: Likewise.
	* g++.dg/concepts/pr65681.C: Likewise.
	* g++.dg/concepts/req7.C: Likewise.
	* g++.dg/concepts/req12.C: Likewise.
	* g++.dg/concepts/fn5.C: Likewise.
	* g++.dg/concepts/alias4.C: Likewise.
	* g++.dg/concepts/generic-fn.C: Likewise.
	* g++.dg/concepts/feature-macro.C: Likewise.
	* g++.dg/concepts/req19.C: Likewise.
	* g++.dg/concepts/placeholder3.C: Likewise.
	* g++.dg/concepts/intro3.C: Likewise.
	* g++.dg/concepts/partial-spec5.C: Likewise.
	* g++.dg/concepts/template-parm4.C: Likewise.
	* g++.dg/concepts/dr1430.C: Likewise.
	* g++.dg/concepts/pr65634.C: Likewise.
	* g++.dg/concepts/var-concept4.C: Likewise.
	* g++.dg/concepts/pr67249.C: Likewise.
	* g++.dg/concepts/expression.C: Likewise.
	* g++.dg/concepts/pr65575.C: Likewise.
	* g++.dg/concepts/partial-spec2.C: Likewise.
	* g++.dg/concepts/template-parm9.C: Likewise.
	* g++.dg/concepts/inherit-ctor1.C: Likewise.
	* g++.dg/concepts/equiv2.C: Likewise.
	* g++.dg/concepts/req11.C: Likewise.
	* g++.dg/concepts/template-parm1.C: Likewise.
	* g++.dg/concepts/inherit-ctor2.C: Likewise.
	* g++.dg/concepts/var-concept1.C: Likewise.
	* g++.dg/concepts/fn3.C: Likewise.
	* g++.dg/torture/pr46364.C: Likewise.
	* g++.dg/torture/stackalign/eh-alloca-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-fastcall-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-vararg-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-vararg-2.C: Likewise.
	* g++.dg/torture/stackalign/eh-global-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-thiscall-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-inline-2.C: Likewise.
	* g++.dg/torture/stackalign/eh-inline-1.C: Likewise.
	* g++.dg/torture/pr52918-1.C: Likewise.
	* g++.dg/torture/pr49394.C: Likewise.
	* g++.dg/torture/pr57190.C: Likewise.
	* g++.dg/cpp0x/static_assert8.C: Likewise.
	* g++.dg/cpp0x/noexcept19.C: Likewise.
	* g++.dg/cpp0x/variadic-throw.C: Likewise.
	* g++.dg/cpp0x/variadic73.C: Likewise.
	* g++.dg/cpp0x/noexcept02.C: Likewise.
	* g++.dg/cpp0x/defaulted23.C: Likewise.
	* g++.dg/cpp0x/noexcept08.C: Likewise.
	* g++.dg/cpp0x/auto9.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-eh2.C: Likewise.
	* g++.dg/cpp0x/error5.C: Likewise.
	* c-c++-common/gomp/atomic-12.c: Likewise.
	* c-c++-common/gomp/atomic-13.c: Likewise.
	* c-c++-common/gomp/atomic-14.c: Likewise.
	* c-c++-common/Wvarargs-2.c: Likewise.
	* c-c++-common/Wvarargs.c: Likewise.
	* c-c++-common/vector-subscript-2.c: Likewise.
	* g++.old-deja/g++.robertl/eb123.C: Likewise.
	* g++.old-deja/g++.eh/tmpl3.C: Likewise.
	* g++.old-deja/g++.eh/cleanup2.C: Likewise.
	* g++.old-deja/g++.eh/badalloc1.C: Likewise.
	* g++.old-deja/g++.eh/throw2.C: Likewise.
	* g++.old-deja/g++.eh/throw1.C: Likewise.
	* g++.old-deja/g++.eh/tmpl1.C: Likewise.
	* g++.old-deja/g++.other/new7.C: Likewise.
	* g++.old-deja/g++.other/crash30.C: Likewise.
	* g++.old-deja/g++.other/regstack.C: Likewise.
	* g++.old-deja/g++.other/crash28.C: Likewise.
	* g++.old-deja/g++.jason/bool5.C: Likewise.
	* g++.old-deja/g++.mike/p10416.C: Likewise.
	* g++.old-deja/g++.mike/eh25.C: Likewise.
	* g++.old-deja/g++.mike/eh55.C: Likewise.
libcpp/
	* include/cpplib.h (enum c_lang): Rename CLK_GNUCXX1Z
	to CLK_GNUCXX17 and CLK_CXX1Z to CLK_CXX17.
	* init.c (lang_defaults, cpp_init_builtins): Likewise.
	* expr.c (cpp_classify_number): Use C++17 instead of C++1z
	in diagnostics.
libstdc++-v3/
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Use -std=c++17 or
	-std=gnu++17 instead of -std=c++1z or -std=gnu++1z.  Use c++17 instead
	of c++1z and c++17_only instead of c++1z_only.  Adjust expected
	diagnostics and comments refering to 1z to 17.
	* testsuite/30_threads/lock_guard/cons/deduction.cc: Likewise.
	* testsuite/30_threads/scoped_lock/cons/deduction.cc: Likewise.
	* testsuite/30_threads/scoped_lock/cons/1.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/30_threads/unique_lock/cons/deduction.cc: Likewise.
	* testsuite/18_support/launder/1.cc (test02): Likewise.
	* testsuite/18_support/launder/requirements_neg.cc: Likewise.
	* testsuite/18_support/launder/requirements.cc: Likewise.
	* testsuite/18_support/byte/requirements.cc: Likewise.
	* testsuite/18_support/byte/ops.cc: Likewise.
	* testsuite/18_support/byte/global_neg.cc: Likewise.
	* testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc:
	Likewise.
	* testsuite/27_io/types/4.cc: Likewise.
	* testsuite/25_algorithms/sample/81221.cc: Likewise.
	* testsuite/25_algorithms/sample/1.cc: Likewise.
	* testsuite/25_algorithms/sample/2.cc: Likewise.
	* testsuite/25_algorithms/search/searcher.cc: Likewise.
	* testsuite/28_regex/basic_regex/ctors/deduction.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Likewise.
	* testsuite/24_iterators/range_access_cpp17.cc: Likewise.
	* testsuite/24_iterators/container_access.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/priority_queue_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_map_rand.cc: Likewise.
	* testsuite/20_util/shared_ptr/casts/reinterpret.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/deduction.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/array.cc: Likewise.
	* testsuite/20_util/shared_ptr/observers/array.cc (struct A): Likewise.
	* testsuite/20_util/pair/cons/deduction.cc: Likewise.
	* testsuite/20_util/variant/deduction.cc: Likewise.
	* testsuite/20_util/tuple/78939.cc: Likewise.
	* testsuite/20_util/tuple/cons/deduction.cc: Likewise.
	* testsuite/20_util/void_t/1.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/deduction_neg.cc: Likewise.
	* testsuite/20_util/addressof/requirements/constexpr.cc: Likewise.
	* testsuite/20_util/weak_ptr/cons/deduction.cc: Likewise.
	* testsuite/20_util/has_unique_object_representations/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/has_unique_object_representations/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/has_unique_object_representations/value.cc:
	Likewise.
	* testsuite/20_util/time_point/arithmetic/constexpr.cc: Likewise.
	* testsuite/20_util/function_objects/invoke/59768.cc: Likewise.
	* testsuite/20_util/function_objects/mem_fn/80478.cc: Likewise.
	* testsuite/20_util/function/cons/deduction.cc: Likewise.
	* testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc:
	Likewise.
	* testsuite/20_util/is_aggregate/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_aggregate/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_aggregate/value.cc: Likewise.
	* testsuite/26_numerics/lcm/1.cc: Likewise.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
	* testsuite/26_numerics/gcd/1.cc: Likewise.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/deduction.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/hypot.cc: Likewise.
	* testsuite/23_containers/queue/members/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/array/cons/deduction.cc: Likewise.
	* testsuite/23_containers/array/cons/deduction_neg.cc: Likewise.
	* testsuite/23_containers/deque/modifiers/emplace/cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/deque/cons/deduction.cc: Likewise.
	* testsuite/23_containers/stack/members/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/list/modifiers/emplace/cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/list/cons/deduction.cc: Likewise.
	* testsuite/23_containers/forward_list/modifiers/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/forward_list/cons/deduction.cc: Likewise.
	* testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/emplace/cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/vector/cons/deduction.cc: Likewise.
	* testsuite/23_containers/vector/bool/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/21_strings/basic_string/cons/char/9.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/char/deduction.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/char/79162.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/9.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
	Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/79162.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
	Likewise.

From-SVN: r252826
2017-09-15 18:15:46 +02:00
Jonathan Wakely d0dda80415 PR libstdc++/81468 constrain std::chrono::time_point constructor
PR libstdc++/81468
	* include/std/chrono (__enable_if_is_duration)
	(__disable_if_is_duration): New alias templates to simplify SFINAE.
	(duration_cast, floor, ceil): Use __enable_if_is_duration.
	(duration::__is_float, duration::__is_harmonic): New alias templates
	to simplify SFINAE.
	(duration::duration(const _Rep2&)): Use _Require, __is_float and
	__is_harmonic.
	(duration::duration(const duration<_Rep2, _Period2>&)): Likewise.
	(__common_rep_type): Remove, replace with ...
	(__common_rep_t): New alias template.
	(operator*, operator/, operator%): Use __common_rep_t and
	__disable_if_is_duration.
	(time_point::time_point(const time_point<clock, _Dur2>&)): Add missing
	constraint from LWG DR 1177.
	* testsuite/20_util/duration/cons/dr1177.cc: New.
	* testsuite/20_util/duration/literals/range.cc: Update dg-error line.
	* 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/time_point/cons/81468.cc: New.

From-SVN: r252085
2017-09-13 15:07:44 +01:00
Jonathan Wakely d681026df1 PR libstdc++/79433 no #error for including TS headers with wrong -std
PR libstdc++/79433
	* include/Makefile.am: Remove <bits/c++14_warning.h>.
	* include/Makefile.in: Regenerate.
	* include/bits/c++14_warning.h: Remove.
	* include/experimental/algorithm: Do not include <c++14_warning.h>.
	* include/experimental/any: Likewise.
	* include/experimental/array: Likewise.
	* include/experimental/bits/erase_if.h: Likewise.
	* include/experimental/bits/lfts_config.h: Likewise.
	* include/experimental/bits/shared_ptr.h: Likewise.
	* include/experimental/bits/string_view.tcc: Likewise.
	* include/experimental/chrono: Likewise.
	* include/experimental/deque: Likewise.
	* include/experimental/filesystem: Do not include <c++0x_warning.h>.
	* include/experimental/forward_list: Do not include <c++14_warning.h>.
	* include/experimental/functional: Likewise.
	* include/experimental/iterator: Likewise.
	* include/experimental/list: Likewise.
	* include/experimental/map: Likewise.
	* include/experimental/memory: Likewise.
	* include/experimental/numeric: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/regex: Likewise.
	* include/experimental/set: Likewise.
	* include/experimental/string: Likewise.
	* include/experimental/string_view: Likewise.
	* include/experimental/system_error: Likewise.
	* include/experimental/tuple: Likewise.
	* include/experimental/type_traits: Likewise.
	* include/experimental/unordered_map: Likewise.
	* include/experimental/unordered_set: Likewise.
	* include/experimental/vector: Likewise.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error
	line number.
	* testsuite/experimental/array/neg.cc: Likewise.
	* testsuite/experimental/propagate_const/assignment/move_neg.cc:
	Likewise.
	* testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements2.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements3.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements4.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements5.cc: Likewise.

From-SVN: r252019
2017-09-12 15:03:06 +01:00
Jonathan Wakely c6888c6257 PR libstdc++/79433 no #error for including headers with wrong -std
PR libstdc++/79433
	* doc/xml/manual/status_cxx2017.xml: Update feature-test macros.
	* doc/html/*: Regenerate.
	* include/Makefile.am: Remove <bits/c++17_warning.h>.
	* include/Makefile.in: Regenerate.
	* include/bits/c++17_warning.h: Remove.
	* include/bits/string_view.tcc: Do not include <bits/c++17_warning.h>
	for pre-C++17 modes.
	* include/std/any: Likewise.
	(__cpp_lib_any): Define.
	* include/std/mutex (__cpp_lib_scoped_lock): Adjust value as per new
	SD-6 draft.
	* include/std/numeric (__cpp_lib_gcd_lcm): Define as per new SD-6
	draft.
	* include/std/optional: Do not include <bits/c++17_warning.h>.
	(__cpp_lib_optional): Define.
	* include/std/shared_mutex: Do not include <bits/c++14_warning.h>.
	* include/std/string_view: Do not include <bits/c++17_warning.h>.
	(__cpp_lib_string_view): Define.
	* include/std/variant: Do not include <bits/c++17_warning.h>.
	(__cpp_lib_variant): Define.
	* testsuite/20_util/optional/cons/value_neg.cc: Adjust dg-error line
	numbers.
	* testsuite/26_numerics/gcd/1.cc: Test for __cpp_lib_gcd_lcm.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Adjust dg-error line
	numbers.
	* testsuite/26_numerics/lcm/1.cc: Test for __cpp_lib_gcd_lcm.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Adjust dg-error line
	numbers.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Adjust
	expected value of __cpp_lib_scoped_lock.

From-SVN: r252018
2017-09-12 15:02:59 +01:00
Jonathan Wakely 2be7a166a9 PR libstdc++/70483 make std::experimental::string_view fully constexpr
PR libstdc++/70483
	* include/experimental/bits/string_view.tcc (basic_string_view::find)
	(basic_string_view::rfind, basic_string_view::find_first_of)
	(basic_string_view::find_last_of, basic_string_view::find_first_not_of)
	(basic_string_view::find_last_not_of): Add constexpr specifier.
	* include/experimental/string_view (basic_string_view::remove_prefix)
	(basic_string_view::remove_suffix, basic_string_view::swap)
	(basic_string_view::compare, basic_string_view::find)
	(basic_string_view::rfind, basic_string_view::find_first_of)
	(basic_string_view::find_last_of, basic_string_view::find_first_not_of)
	(basic_string_view::find_last_not_of, operator==, operator!=)
	(operator<, operator>, operator<=, operator>=): Likewise.
	* testsuite/experimental/string_view/operations/compare/char/70483.cc:
	New.

From-SVN: r252017
2017-09-12 14:31:20 +01:00
Jonathan Wakely c5ae1a27bd PR libstdc++/70483 make std::string_view fully constexpr
PR libstdc++/70483
	* include/bits/string_view.tcc (basic_string_view::find)
	(basic_string_view::rfind, basic_string_view::find_first_of)
	(basic_string_view::find_last_of, basic_string_view::find_first_not_of)
	(basic_string_view::find_last_not_of): Add constexpr specifier.
	* include/std/string_view (basic_string_view::operator=)
	(basic_string_view::rbegin, basic_string_view::rend)
	(basic_string_view::crbegin, basic_string_view::crend)
	(basic_string_view::remove_prefix, basic_string_view::remove_suffix)
	(basic_string_view::swap, basic_string_view::compare)
	(basic_string_view::find, basic_string_view::rfind)
	(basic_string_view::find_first_of, basic_string_view::find_last_of)
	(basic_string_view::find_first_not_of)
	(basic_string_view::find_last_not_of, basic_string_view::_M_check)
	(basic_string_view::_M_limit, operator==, operator!=, operator<)
	(operator>, operator<=, operator>=): Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/
	char/1.cc: Repeat tests in constexpr context.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/
	wchar_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/
	char/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/
	wchar_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operators/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/range_access/char/1.cc: Test
	cbegin, cend, rbegin, rend, crbegin and crend.
	* testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/1.cc:
	Remove trailing whitespace.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/
	1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc:
	New.
	* testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc:
	New.
	* testsuite/21_strings/basic_string_view/operations/compare/char/2.cc:
	New.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/
	2.cc: New.

From-SVN: r251988
2017-09-11 22:47:41 +01:00
Tim Shen 3366a47408 re PR libstdc++/71500 (regex::icase only works on first character in a range)
PR libstdc++/71500
	* include/bits/regex_executor.tcc: Support icase in regex_tratis<...>
	for back reference matches.
	* testsuite/28_regex/regression.cc: Test case.

From-SVN: r251982
2017-09-11 19:02:34 +00:00
Jonathan Wakely 47d7966a70 Adjust test to pass with old std::string
* testsuite/21_strings/basic_string/lwg2946.cc: Adjust for
	compatibility with old COW std::string.

From-SVN: r251981
2017-09-11 17:54:57 +01:00
Daniel Kruegler df66af3b1e PR libstdc++/79162 implement LWG 2946 and LWG 2758
2017-09-04  Daniel Kruegler  <daniel.kruegler@gmail.com>

	PR libstdc++/79162
	Implement LWG 2946, LWG 2758's resolution missed further corrections
	* include/bits/basic_string.h (basic_string::compare): Add missing
	required noexcept specifications.
	(basic_string): Introduce internal _S_to_string_view and __sv_wrapper
	for implicit string_view conversion.
	(basic_string::basic_string): Fix explicit string_view conversion by
	implicit conversion using _S_to_string_view and __sv_wrapper.
	(basic_string): Introduce internal basic_string(__sv_wrapper, Alloc)
	constructor.
	(basic_string): Fix operator=(T) template by operator=(const T&)
	template for uncopyable types (PR 79162).
	(basic_string::operator+=, basic_string::append, basic_string::assign)
	(basic_string::insert, basic_string::replace, basic_string::find)
	(basic_string::rfind, basic_string::find_first_of)
	(basic_string::find_last_of, basic_string::find_first_not_of)
	(basic_string::find_last_not_of, basic_string::compare): Replace
	__sv_type argument by template const T& (LWG 2946) and correct
	documentation describing __sv_type argument.
	(basic_string::find, basic_string::rfind, basic_string::find_first_of)
	(basic_string::find_last_of, basic_string::find_first_not_of)
	(basic_string::find_last_not_of, basic_string::compare): Replace
	unconditional noexcept specification by conditional noexcept
	specification to partially balance the removal of noexcept by LWG 2946.
	* testsuite/21_strings/basic_string/79162.cc: New.
	* testsuite/21_strings/basic_string/lwg2946.cc: New.

From-SVN: r251664
2017-09-04 16:48:47 +01:00
Jonathan Wakely 2c0378f467 PR libstdc++/81912 make std::__iterator_category constexpr
PR libstdc++/81912
	* include/bits/stl_iterator_base_types.h (__iterator_category): Add
	constexpr for C++11 and later.
	* testsuite/24_iterators/container_access.cc: Add target selector.
	* testsuite/24_iterators/range_access.cc: Fix clause number in
	comment.
	* testsuite/24_iterators/range_access_cpp14.cc: Likewise.
	* testsuite/24_iterators/range_access_cpp17.cc: New.

From-SVN: r251234
2017-08-21 16:14:27 +01:00
Richard Biener 1ea85365b4 re PR go/78628 (GO fails to build a translation unit decl)
2017-08-21  Richard Biener  <rguenther@suse.de>

	include/
	* simple-object.h (simple_object_copy_lto_debug_sections): New
	function.

	libiberty/
	* simple-object-common.h (struct simple_object_functions): Add
	copy_lto_debug_sections hook.
	* simple-object.c: Include fcntl.h.
	(handle_lto_debug_sections): New helper function.
	(simple_object_copy_lto_debug_sections): New function copying
	early LTO debug sections to regular debug sections in a new file.
	(simple_object_start_write): Handle NULL segment_name.
	* simple-object-coff.c (simple_object_coff_functions): Adjust
	for not implemented copy_lto_debug_sections hook.
	* simple-object-mach-o.c (simple_object_mach_o_functions): Likewise.
	* simple-object-xcoff.c (simple_object_xcoff_functions): Likewise.
	* simple-object-elf.c (SHT_NULL, SHT_SYMTAB, SHT_RELA, SHT_REL,
	SHT_GROUP): Add various sectopn header types.
	(SHF_EXCLUDE): Add flag.
	(Elf32_External_Sym, Elf64_External_Sym): Add symbol struct.
	(ELF_ST_BIND, ELF_ST_TYPE, ELF_ST_INFO): Add accessors.
	(STT_OBJECT, STT_FUNC, STT_TLS, STT_GNU_IFUNC): Add Symbol types.
	(STV_DEFAULT): Add symbol visibility.
	(SHN_COMMON): Add special section index name.
	(struct simple_object_elf_write): New.
	(simple_object_elf_start_write): Adjust for new private data.
	(simple_object_elf_write_shdr): Pass in values for all fields
	we write.
	(simple_object_elf_write_to_file): Adjust.  Copy from recorded
	section headers if requested.
	(simple_object_elf_release_write): Release private data.
	(simple_object_elf_copy_lto_debug_sections): Copy and rename sections
	as denoted by PFN and all their dependences, symbols and relocations
	to the empty destination file.
	(simple_object_elf_functions): Adjust for copy_lto_debug_sections hook.

        gcc/
        * debug.h (struct gcc_debug_hooks): Add die_ref_for_decl and
        register_external_die hooks.
        (debug_false_tree_charstarstar_uhwistar): Declare.
        (debug_nothing_tree_charstar_uhwi): Likewise.
        * debug.c (do_nothing_debug_hooks): Adjust.
        (debug_false_tree_charstarstar_uhwistar): New do nothing.
        (debug_nothing_tree_charstar_uhwi): Likewise.
        * dbxout.c (dbx_debug_hooks): Adjust.
        (xcoff_debug_hooks): Likewise.
        * sdbout.c (sdb_debug_hooks): Likewise.
        * vmsdbgout.c (vmsdbg_debug_hooks): Likewise.
        * dwarf2out.c (macinfo_label_base): New global.
	(dwarf2out_register_external_die): New function for the
	register_external_die hook.
        (dwarf2out_die_ref_for_decl): Likewise for die_ref_for_decl.
        (dwarf2_debug_hooks): Use them.
        (dwarf2_lineno_debug_hooks): Adjust.
        (struct die_struct): Add with_offset flag.
        (DEBUG_LTO_DWO_INFO_SECTION, DEBUG_LTO_INFO_SECTION,
        DEBUG_LTO_DWO_ABBREV_SECTION, DEBUG_LTO_ABBREV_SECTION,
        DEBUG_LTO_DWO_MACINFO_SECTION, DEBUG_LTO_MACINFO_SECTION,
        DEBUG_LTO_DWO_MACRO_SECTION, DEBUG_LTO_MACRO_SECTION,
        DEBUG_LTO_LINE_SECTION, DEBUG_LTO_DWO_STR_OFFSETS_SECTION,
        DEBUG_LTO_STR_DWO_SECTION, DEBUG_STR_LTO_SECTION): New macros
        defining section names for the early LTO debug variants.
	(reset_indirect_string): New helper.
        (add_AT_external_die_ref): Helper for dwarf2out_register_external_die.
        (print_dw_val): Add support for offsetted symbol references.
	(get_ultimate_context): Split out from is_cxx.
	(is_cxx): Use get_ultimate_context.
	(is_fortran): Add decl overload.
        (compute_comp_unit_symbol): Split out worker from
	compute_section_prefix.
        (compute_section_prefix): Call compute_comp_unit_symbol and
	set comdat_type_p here.
        (output_die): Skip DIE symbol output for the LTO added one.
        Handle DIE symbol references with offset.
        (output_comp_unit): Guard section name mangling properly.
        For LTO debug sections emit a symbol at the section beginning
        which we use to refer to its DIEs.
        (add_abstract_origin_attribute): For DIEs registered via
        dwarf2out_register_external_die directly refer to the early
        DIE rather than indirectly through the shadow one we created.
	Remove obsolete call to dwarf2out_abstract_function for
	non-function/block origins.
        (gen_array_type_die): When generating early LTO debug do
        not emit DW_AT_string_length.
        (gen_formal_parameter_die): Do not re-create DIEs for PARM_DECLs
        late when in LTO.  As suggested place a gcc_unreachable for
	the DECL_ABSTRACT_P case.
        (gen_subprogram_die): Avoid another specification DIE
        for early built declarations/definitions for the late LTO case.
        (gen_variable_die): Add type references for late duplicated VLA dies
        when in late LTO.
        (gen_inlined_subroutine_die): Do not call dwarf2out_abstract_function,
        we have the abstract instance already.
        (process_scope_var): Adjust decl DIE contexts in LTO which
        first puts them in limbo.
        (gen_decl_die): Do not generate type DIEs late apart from
        types for VLAs or for decls we do not yet have a DIE.  Do not
	call dwarf2out_abstract_function late.
        (dwarf2out_early_global_decl): Make sure to create DIEs
        for abstract instances of a decl first.
        (dwarf2out_late_global_decl): Adjust comment.
        (output_macinfo_op): With multiple macro sections use
	macinfo_label_base to distinguish labels.
        (output_macinfo): Likewise.  Update macinfo_label_base.
	Pass in the line info label.
	(note_variable_value_in_expr): When generating LTO resolve
	all variable values here by generating DIEs as needed.
        (init_sections_and_labels): Add early LTO debug flag parameter
        and generate different sections and names if set.  Add generation
        counter for the labels so we can have multiple of them.
        (reset_dies): Helper to allow DIEs to be output multiple times.
        (dwarf2out_finish): When outputting DIEs to the fat part of an
	LTO object first reset DIEs.
        (dwarf2out_early_finish): Output early DIEs when generating LTO.
	(modified_type_die): Check for decl_ultimate_origin being self
	before recursing.
	(gen_type_die_with_usage): Likewise.
	(gen_typedef_die): Allow decl_ultimate_origin being self.
        (set_decl_abstract_flags): Remove.
        (set_block_abstract_flags): Likewise.
        (dwarf2out_abstract_function): Treat the early generated DIEs
        as the abstract copy and only add DW_AT_inline and
        DW_AT_artificial here and call set_decl_origin_self.
	If the DIE has an abstract origin don't do anything.
	* tree.c (free_lang_data): Build a dummy TRANSLATION_UNIT_DECL
	if we have none yet (Go fails to build one, PR78628).
	(variably_modified_type_p): Prevent endless recursion for Ada
	cyclic pointer types.
        * lto-streamer-in.c: Include debug.h.
        (dref_queue): New global.
        (lto_read_tree_1): Stream in DIE references.
        (lto_input_tree): Register DIE references.
	(input_function): Stream DECL_DEBUG_ARGS.
        * lto-streamer-out.c: Include debug.h.
        (lto_write_tree_1): Output DIE references.
        (DFS::DFS_write_tree_body): Follow DECL_ABSTRACT_ORIGIN.
	Force a TRANSLATION_UNIT_DECL DECL_CONTEXT for file-scope decls.
	(output_function): Stream DECL_DEBUG_ARGS.
        * tree-streamer-in.c (lto_input_ts_decl_common_tree_pointers):
        Stream DECL_ABSTRACT_ORIGIN.
        * tree-streamer-out.c (write_ts_decl_common_tree_pointers): Likewise.
	(write_ts_decl_minimal_tree_pointers): Force a TRANSLATION_UNIT_DECL
	DECL_CONTEXT for file-scope decls.
        * lto-streamer.h (struct dref_entry): Declare.
        (dref_queue): Likewise.
	* cfgexpand.c (pass_expand::execute): Do not call the
	outlining_inline_function hook here.
        * lto-wrapper.c (debug_obj): New global.
        (tool_cleanup): Unlink it if required.
        (debug_objcopy): New function.
        (run_gcc): Handle early debug sections in the IL files by
        extracting them to separate files, partially linkin them and
        feeding the result back as result to the linker.

        * config/darwin.h (DEBUG_LTO_INFO_SECTION, DEBUG_LTO_ABBREV_SECTION,
        DEBUG_LTO_MACINFO_SECTION, DEBUG_LTO_LINE_SECTION,
        DEBUG_STR_LTO_SECTION, DEBUG_LTO_MACRO_SECTION): Put early debug
        sections into a separate segment.
        * config/darwin.c (darwin_asm_named_section): Handle __GNU_DWARF_LTO
        segments.
        (darwin_asm_dwarf_section): Likewise.
        (darwin_asm_output_dwarf_offset): Likewise.

	* config/i386/i386.c (make_resolver_func): Set DECL_IGNORED_P.

        lto/
        * lto.c (unify_scc): Truncate DIE reference queue for dropped SCCs.
        (lto_read_decls): Process TRANSLATION_UNIT_DECLs.  Remove
        TYPE_DECL debug processing, register DIE references from
        prevailing SCCs with the debug machinery.
        (lto_section_with_id): Handle LTO debug sections.

	libstdc++/
	* testsuite/libstdc++-prettyprinters/prettyprinters.exp: Run all
	tests with -flto as well if supported.

        testsuite/
	* c-c++-common/asan/global-overflow-1.c: Adjust diagnostic location
	regex to handle the LTO case.
	* c-c++-common/asan/heap-overflow-1.c: Likewise.
	* c-c++-common/asan/misalign-1.c: Likewise.
	* c-c++-common/asan/misalign-2.c: Likewise.
	* c-c++-common/asan/null-deref-1.c: Likewise.
	* c-c++-common/asan/stack-overflow-1.c: Likewise.
	* c-c++-common/asan/strncpy-overflow-1.c: Likewise.
	* c-c++-common/asan/use-after-free-1.c: Likewise.
	* c-c++-common/asan/alloca_big_alignment.c: Likewise.
	* c-c++-common/asan/alloca_detect_custom_size.c: Likewise.
	* c-c++-common/asan/alloca_overflow_partial.c: Likewise.
	* c-c++-common/asan/alloca_overflow_right.c: Likewise.
	* c-c++-common/asan/alloca_underflow_left.c: Likewise.
	* g++.dg/asan/large-func-test-1.C: Likewise.
	* gfortran.dg/save_6.f90: Add -flto -g variant of save_5.f90.

From-SVN: r251220
2017-08-21 10:29:00 +00:00
John David Anglin ab7fc02ec1 re PR testsuite/81056 (FAIL: 17_intro/names.cc (test for excess errors))
PR testsuite/81056
	* testsuite/17_intro/names.cc: Undef 'd' and 'r' on __hpux__

From-SVN: r251208
2017-08-20 18:52:59 +00:00
Jonathan Wakely 676c4146f5 PR libstdc++/81891 fix double-free in hashtable constructor
PR libstdc++/81891
	* include/bits/hashtable.h (_Hashtable(_InputIterator, _InputIterator,
	size_type, const _H1&, const _H2&, const _Hash&, const _Equal&,
	const _ExtractKey&, const allocator_type&)): Let destructor do clean
	up if an exception is thrown.
	* testsuite/23_containers/unordered_map/cons/81891.cc: New.

From-SVN: r251185
2017-08-18 18:46:57 +01:00
Jonathan Wakely 1ea93d89a9 PR libstdc++/81808 skip test if reading directory doesn't fail
PR libstdc++/81808
	* testsuite/27_io/basic_fstream/53984.cc: Adjust test for targets
	that allow opening a directory as a FILE and reading from it.

From-SVN: r251041
2017-08-11 01:14:57 +01:00
Jonathan Wakely 04d07b61cb PR libstdc++/81751 don't call fflush(NULL)
PR libstdc++/79820
	PR libstdc++/81751
	* config/io/basic_file_stdio.cc (sys_open(FILE*, ios_base::openmode)):
	Call fflush on the stream instead of calling sync() while _M_cfile is
	null. Restore original value of errno.
	* testsuite/ext/stdio_filebuf/char/79820.cc: New.
	* testsuite/ext/stdio_filebuf/char/81751.cc: New.

From-SVN: r250993
2017-08-09 18:52:10 +01:00
Jonathan Wakely 958dc0c224 PR libstdc++/53984 fix failing test
PR libstdc++/53984
	* testsuite/27_io/basic_fstream/53984.cc: Fix test.

From-SVN: r250594
2017-07-26 23:06:13 +01:00
Paolo Carlini 3b1aa533df 53984.cc: Fix typo in dg-require directive.
2017-07-26  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/27_io/basic_fstream/53984.cc: Fix typo in dg-require
	directive.

From-SVN: r250575
2017-07-26 14:13:15 +00:00
Jonathan Wakely c2830789ba PR libstdc++/53984 handle exceptions in basic_istream::sentry
PR libstdc++/53984
	* include/bits/basic_ios.h (basic_ios::_M_setstate): Adjust comment.
	* include/bits/istream.tcc (basic_istream::sentry): Handle exceptions
	during construction.
	* include/std/istream: Adjust comments for formatted input functions
	and unformatted input functions.
	* testsuite/27_io/basic_fstream/53984.cc: New.
	* testsuite/27_io/basic_istream/sentry/char/53984.cc: New.

From-SVN: r250545
2017-07-25 21:36:06 +01:00
Jonathan Wakely a74bc411bc Remove deprecated iostream members for C++17
* include/bits/ios_base.h (ios_base::io_state, ios_base::open_mode)
	(ios_base::seek_dir): Remove for C++17.
	* include/std/streambuf (basic_streambuf::stossc): Remove for C++17.
	Add deprecated attribute for C++11 and C++14.
	* testsuite/27_io/types/1.cc: Don't run for C++17 and later.
	* testsuite/27_io/types/4.cc: New.

From-SVN: r250531
2017-07-25 18:47:52 +01:00
François Dumont 4a15d84228 re PR libstdc++/81064 (Inline namespace regression)
2017-07-23  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/81064
	* include/bits/algorithmfwd.h: Reorganize versioned namespace.
	* include/bits/basic_string.h: Likewise.
	* include/bits/c++config: Likewise.
	* include/bits/deque.tcc: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/forward_list.tcc: Likewise.
	* include/bits/hashtable_policy.h: Likewise.
	* include/bits/list.tcc: Likewise.
	* include/bits/move.h: Likewise.
	* include/bits/quoted_string.h: Likewise.
	* include/bits/random.h: Likewise.
	* include/bits/random.tcc: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/regex.tcc: Likewise.
	* include/bits/regex_automaton.h: Likewise.
	* include/bits/regex_automaton.tcc: Likewise.
	* include/bits/regex_compiler.h: Likewise.
	* include/bits/regex_compiler.tcc: Likewise.
	* include/bits/regex_constants.h: Likewise.
	* include/bits/regex_error.h: Likewise.
	* include/bits/regex_executor.h: Likewise.
	* include/bits/regex_executor.tcc: Likewise.
	* include/bits/regex_scanner.h: Likewise.
	* include/bits/regex_scanner.tcc: Likewise.
	* include/bits/specfun.h: Likewise.
	* include/bits/stl_algo.h: Likewise.
	* include/bits/stl_algobase.h: Likewise.
	* include/bits/stl_bvector.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_iterator.h: Likewise.
	* include/bits/stl_iterator_base_funcs.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_relops.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/uniform_int_dist.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/bits/vector.tcc: Likewise.
	* include/c_global/cmath: Likewise.
	* include/c_std/cmath: Likewise.
	* include/decimal/decimal: Likewise.
	* include/decimal/decimal.h: Likewise.
	* include/experimental/algorithm: Likewise.
	* include/experimental/any: Likewise.
	* include/experimental/array: Likewise.
	* include/experimental/bits/erase_if.h: Likewise.
	* include/experimental/bits/fs_dir.h: Likewise.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/bits/lfts_config.h: Likewise.
	* include/experimental/bits/shared_ptr.h: Likewise.
	* include/experimental/bits/string_view.tcc: Likewise.
	* include/experimental/chrono: Likewise.
	* include/experimental/deque: Likewise.
	* include/experimental/filesystem: Likewise.
	* include/experimental/forward_list: Likewise.
	* include/experimental/functional: Likewise.
	* include/experimental/iterator: Likewise.
	* include/experimental/list: Likewise.
	* include/experimental/map: Likewise.
	* include/experimental/memory: Likewise.
	* include/experimental/memory_resource: Likewise.
	* include/experimental/numeric: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/random: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/regex: Likewise.
	* include/experimental/set: Likewise.
	* include/experimental/source_location: Likewise.
	* include/experimental/string: Likewise.
	* include/experimental/string_view: Likewise.
	* include/experimental/system_error: Likewise.
	* include/experimental/tuple: Likewise.
	* include/experimental/type_traits: Likewise.
	* include/experimental/unordered_map: Likewise.
	* include/experimental/unordered_set: Likewise.
	* include/experimental/utility: Likewise.
	* include/experimental/vector: Likewise.
	* include/ext/bitmap_allocator.h: Likewise.
	* include/ext/codecvt_specializations.h: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/typelist.h: Likewise.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/std/functional: Likewise.
	* include/std/numeric: Likewise.
	* include/std/string_view: Likewise.
	* include/std/thread: Likewise.
	* include/std/variant: Likewise.
	* include/tr1/array: Likewise.
	* include/tr1/bessel_function.tcc: Likewise.
	* include/tr1/beta_function.tcc: Likewise.
	* include/tr1/cmath: Likewise.
	* include/tr1/complex: Likewise.
	* include/tr1/ell_integral.tcc: Likewise.
	* include/tr1/exp_integral.tcc: Likewise.
	* include/tr1/functional: Likewise.
	* include/tr1/functional_hash.h: Likewise.
	* include/tr1/gamma.tcc: Likewise.
	* include/tr1/hashtable.h: Likewise.
	* include/tr1/hashtable_policy.h: Likewise.
	* include/tr1/hypergeometric.tcc: Likewise.
	* include/tr1/legendre_function.tcc: Likewise.
	* include/tr1/modified_bessel_func.tcc: Likewise.
	* include/tr1/poly_hermite.tcc: Likewise.
	* include/tr1/poly_laguerre.tcc: Likewise.
	* include/tr1/random.h: Likewise.
	* include/tr1/random.tcc: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr1/riemann_zeta.tcc: Likewise.
	* include/tr1/shared_ptr.h: Likewise.
	* include/tr1/special_function_util.h: Likewise.
	* include/tr1/tuple: Likewise.
	* include/tr1/type_traits: Likewise.
	* include/tr1/unordered_map.h: Likewise.
	* include/tr1/unordered_set.h: Likewise.
	* include/tr1/utility: Likewise.
	* include/tr2/bool_set: Likewise.
	* include/tr2/bool_set.tcc: Likewise.
	* include/tr2/dynamic_bitset: Likewise.
	* include/tr2/dynamic_bitset.tcc: Likewise.
	* include/tr2/ratio: Likewise.
	* include/tr2/type_traits: Likewise.
	* src/c++11/chrono.cc: Likewise.
	* src/c++11/compatibility-c++0x.cc: Likewise.
	* src/c++11/compatibility-chrono.cc: Likewise.
	* src/c++11/cxx11-shim_facets.cc: Likewise.
	* src/c++11/hashtable_c++0x.cc: Likewise.
	* src/c++11/placeholders.cc: Likewise.
	* src/c++11/thread.cc: Likewise.
	* src/c++98/bitmap_allocator.cc: Likewise.
	* src/c++98/hashtable_tr1.cc: Likewise.
	* src/c++98/list.cc: Likewise.
	* src/shared/hashtable-aux.cc: Likewise.
	* testsuite/20_util/duration/literals/range.cc: Adapt line number.
	* 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/forward/c_neg.cc: Likewise.
	* testsuite/20_util/forward/f_neg.cc: Likewise.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Likewise.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
	* testsuite/26_numerics/random/pr60037-neg.cc: Likewise.
	* python/libstdcxx/v6/printers.py: Adapt.

From-SVN: r250458
2017-07-23 08:41:35 +00:00
Jonathan Wakely 304a15ec64 PR libstdc++/81476 Optimise vector insertion from input iterators
PR libstdc++/81476
	* include/bits/vector.tcc (vector::_M_range_insert<_InputIterator>):
	Only insert elements one-by-one when inserting at the end.
	* testsuite/performance/23_containers/insert/81476.cc: New.

From-SVN: r250366
2017-07-19 20:32:15 +01:00
Jonathan Wakely 4e66b02bc1 Fix indentation in libstdc++ testsuite utils
* testsuite/util/testsuite_iterators.h: Fix indentation.

From-SVN: r250349
2017-07-19 15:49:00 +01:00
Jonathan Wakely 1f78c47bf0 Use dg-require-fileio in new test
* testsuite/27_io/basic_filebuf/sgetn/char/81395.cc: Add dg-require.

From-SVN: r250333
2017-07-19 01:23:00 +01:00
Jonathan Wakely fddcd19abf PR libstdc++/81395 fix crash when write follows large read
PR libstdc++/81395
	* include/bits/fstream.tcc (basic_filebuf::xsgetn): Don't set buffer
	pointers for write mode after reading.
	* testsuite/27_io/basic_filebuf/sgetn/char/81395.cc: New.

From-SVN: r250328
2017-07-19 00:39:34 +01:00
François Dumont 4f9e1f4d9d stl_list.h (struct _List_node_header): New.
2017-07-18  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_list.h
	(struct _List_node_header): New.
	(_List_impl()): Fix noexcept qualification.
	(_List_impl(_List_impl&&)): New, default.
	(_List_base()): Default.
	(_List_base(_List_base&&)): Default.
	(_List_base::_M_move_nodes): Adapt to use
	_List_node_header._M_move_nodes.
	(_List_base::_M_init): Likewise.
	(list<>()): Default.
	(list<>(list&&)): Default.
	(list<>::_M_move_assign(list&&, true_type)): Use _M_move_nodes.
	(__distance(_List_const_iterator<>, _List_const_iterator<>,
	input_iterator_tag)): Adapt.
	* testsuite/23_containers/list/allocator/default_init.cc: New.

From-SVN: r250320
2017-07-18 20:26:08 +00:00
Jonathan Wakely e12d3780e6 Reorder std::scoped_lock parameters as per P0739R0 DR status
* include/std/mutex (scoped_lock): Reorder std::adopt_lock_t parameter
	as per P0739R0.
	* testsuite/30_threads/scoped_lock/cons/1.cc: Reorder arguments.
	* testsuite/30_threads/scoped_lock/cons/deduction.cc: Test deduction
	with std::adopt_lock_t.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Check
	feature-test macro.

From-SVN: r250223
2017-07-15 16:43:22 +01:00
Jason Merrill 20316b9b2e Constrain std::variant constructor for class template argument deduction
2017-07-14  Jason Merrill  <jason@redhat.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	* include/std/variant (variant::variant(_Tp&&)): Constrain to remove
	the constructor for empty variants from the candidate functions
	during class template argument deduction.
	* testsuite/20_util/variant/deduction.cc: New.

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

From-SVN: r250213
2017-07-14 20:13:49 +01:00
Jonathan Wakely b0e90d2acf Include missing header for std::free
* testsuite/abi/pr42230.cc: Add header for std::free.

From-SVN: r250102
2017-07-10 19:43:02 +01:00
Jonathan Wakely 387c17d312 PR libstdc++/81381 support stateful allocators in basic_stringbuf
PR libstdc++/81381
	* include/bits/sstream.tcc (basic_stringbuf::overflow)
	(basic_stringbuf::basic_stringbuf(const __string_type&, ios::mode))
	(basic_stringbuf::str()): Construct new strings with an allocator.
	* testsuite/27_io/basic_stringbuf/cons/81381.cc: New.

From-SVN: r250101
2017-07-10 18:59:02 +01:00
Jonathan Wakely 93ef155b3d PR libstdc++/81338 correctly manage string capacity
PR libstdc++/81338
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] (basic_string):
	Declare basic_stringbuf to be a friend.
	* include/bits/sstream.tcc (basic_stringbuf::overflow)
	[_GLIBCXX_USE_CXX11_ABI]: Use unused capacity before reallocating.
	* include/std/sstream (basic_stringbuf::__xfer_bufptrs): Update string
	length to buffer length.
	* testsuite/27_io/basic_stringstream/assign/81338.cc: New.

From-SVN: r250100
2017-07-10 18:58:56 +01:00
Jonathan Wakely 32aaf6ef10 Fix memory leaks in libstdc++ tests
* testsuite/20_util/specialized_algorithms/memory_management_tools/
	1.cc: Free memory.
	* testsuite/22_locale/locale/cons/5.cc: Remove redundant restoration
	of original environment and free memory.

From-SVN: r250021
2017-07-06 13:42:51 +01:00
Jonathan Wakely 4f7c2c7ff2 Fix memory leaks in libstdc++ ABI tests
* testsuite/abi/pr42230.cc: Free memory.
	* testsuite/util/testsuite_abi.cc (demangle): Return std::string
	instead of pointer that might need freeing.
	* testsuite/util/testsuite_abi.h (demangle): Likewise.
	* testsuite/util/testsuite_hooks.cc (verify_demangle): Free memory.

From-SVN: r250020
2017-07-06 13:42:46 +01:00
Tim Shen 7050372474 re PR libstdc++/80187 (C++ variant should be trivially copy constructible if possible)
PR libstdc++/80187
	* include/std/variant (variant::variant, variant::~variant,
	variant::operator=): Implement triviality forwarding for four
	special member functions.
	* testsuite/20_util/variant/compile.cc: Tests.

From-SVN: r249706
2017-06-27 18:19:03 +00:00
Jonathan Wakely 68fe5f441e PR libstdc++/81221 only run new test for check-parallel
PR libstdc++/81221
	* testsuite/25_algorithms/sample/81221.cc: Disable except for
	check-parallel.

From-SVN: r249697
2017-06-27 17:19:16 +01:00