Commit Graph

5293 Commits

Author SHA1 Message Date
Jonathan Wakely 89f0694859 any (__any_caster): Define at namespace scope so the name is visible to name lookup.
* include/experimental/any (__any_caster): Define at namespace scope
	so the name is visible to name lookup.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error.

From-SVN: r227042
2015-08-20 21:19:58 +01:00
Paolo Carlini dce573c43f cmath: Fix typo in comment.
2015-08-19  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/c_global/cmath: Fix typo in comment.

From-SVN: r227007
2015-08-19 13:20:29 +00:00
Paolo Carlini 157177af99 cmath: Revert fix for libstdc++/58625...
2015-08-19  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/c_global/cmath: Revert fix for libstdc++/58625, no
	longer necessary (__builtin_signbit is now type-generic).

From-SVN: r227006
2015-08-19 13:17:51 +00:00
Jonathan Wakely e92e7c15e1 * include/bits/ptr_traits.h: Include <bits/move.h> for addressof.
From-SVN: r226985
2015-08-18 19:04:42 +01:00
Jonathan Wakely 4c2b10d6a4 re PR libstdc++/67066 (libstdc++-v3/src/filesystem/dir.cc fails to compile with --enable-concept-checks)
PR libstdc++/67066
	* doc/xml/manual/configure.xml (manual.intro.setup.configure): Add
	caveats for --enable-concept-checks. Improve link text.
	* doc/xml/manual/diagnostics.xml (std.diagnostics.concept_checking):
	Clarify caveats.
	* doc/html/*: Regenerate.
	* include/bits/stl_deque.h (deque): Only use concept checks in C++03.
	* include/bits/stl_stack.h (stack): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.

From-SVN: r226984
2015-08-18 19:04:32 +01:00
Jonathan Wakely 2548a4d6ba any (any::operator=(const any&)): Move check for self-assignment.
* include/experimental/any (any::operator=(const any&)): Move check
	for self-assignment.
	(any::operator=(any&&)): Add check for self-assignment.
	(any::operator=(_ValueType&&)): Constrain template argument.
	(any::swap(any&)): Add check for self-swap.
	* testsuite/experimental/any/assign/self.cc: Test move and swap.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Update dg-error.

From-SVN: r226894
2015-08-14 12:51:18 +01:00
Jonathan Wakely 357c9f7edc array: Add feature-test macro.
* include/experimental/array: Add feature-test macro.
	* testsuite/experimental/array/neg.cc: Update dg-error.

From-SVN: r226893
2015-08-14 12:51:05 +01:00
Ville Voutilainen 9638eccd55 Implement std::experimental::fundamentals_v2::make_array and std::experimental::fundamentals_v2::to_array.
2015-08-13  Ville Voutilainen  <ville.voutilainen@gmail.com>

	Implement std::experimental::fundamentals_v2::make_array and
	std::experimental::fundamentals_v2::to_array.
	* include/Makefile.am: Add array.
	* include/Makefile.in: Add array.
	* include/experimental/array: New.
	* testsuite/experimental/array/make_array.cc: Likewise.
	* testsuite/experimental/array/neg.cc: Likewise.
	* doc/html/manual/status.html: Mark make_array as Y.
	* doc/xml/manual/status_cxx2017.xml: Likewise.

From-SVN: r226865
2015-08-13 17:55:46 +03:00
Jonathan Wakely db23e4c46f alloc_traits.h: Add feature-test macro.
* include/bits/alloc_traits.h: Add feature-test macro.
	* include/bits/allocator.h: Likewise.
	* include/bits/range_access.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/unordered_map.h: Likewise.

From-SVN: r226864
2015-08-13 14:57:41 +01:00
Eelis van der Weegen 4c80e54478 shared_mutex (shared_mutex::unlock()): Fix typo.
2015-08-13  Eelis van der Weegen  <eelis@eelis.net>

	* include/std/shared_mutex (shared_mutex::unlock()): Fix typo.

From-SVN: r226862
2015-08-13 14:57:28 +01:00
Ville Voutilainen b95170d380 Implement N4279, Improved insertion interface for unique-key maps.
2015-08-09  Ville Voutilainen  <ville.voutilainen@gmail.com>

	Implement N4279, Improved insertion interface for unique-key maps.
	* include/bits/stl_map.h (try_emplace, insert_or_assign): New.
	* include/bits/stl_tree.h (_M_get_insert_unique_pos,
	_M_get_insert_equal_pos, _M_get_insert_hint_unique_pos,
	_M_get_insert_hint_equal_pos): Make public.
	* include/bits/unordered_map.h (try_emplace, insert_or_assign): New.
	* testsuite/23_containers/map/modifiers/insert_or_assign/1.cc:
	Likewise.
	* testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise.
	* testsuite/23_containers/unordered_map/modifiers/insert_or_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/modifiers/try_emplace.cc:
	Likewise.

From-SVN: r226743
2015-08-09 01:57:13 +03:00
Ville Voutilainen f334456903 Implement N4089 Safe conversions in unique_ptr<T[]> (LWG 2118) and N4366 LWG 2228...
2015-08-08  Ville Voutilainen  <ville.voutilainen@gmail.com>

	Implement N4089 Safe conversions in unique_ptr<T[]> (LWG 2118)
	and N4366 LWG 2228: Missing SFINAE rule in unique_ptr
	templated assignment
	* include/bits/unique_ptr.h
	(__remove_cv, __is_derived_Tp): Remove.
	(default_delete::default_delete(const default_delete<_Up[]>)):
	Constrain with array convertibility.
	(default_delete::operator(_Up*)): Turn into a template,
	constrain with array convertibility.
	(__safe_conversion_up): New, single object version.
	(unique_ptr(unique_ptr<_Up, _Ep>&&)): Constrain with deleter
	convertibility.
	(unique_ptr::operator=(unique_ptr<_Up, _Ep>&&)): Likewise, and add
	is_assignable as a constraint.
	(__safe_conversion_up): Array version, renamed from __safe_conversion,
	updated to implement N4089.
	(__safe_conversion_raw): New.
	(unique_ptr(_Up)): Turn into a template, constrain with array
	convertibility.
	(unique_ptr(_Up,
        typename conditional<is_reference<deleter_type>::value,
        deleter_type, const deleter_type&>::type)): Likewise.
	(unique_ptr(_Up, typename
 	remove_reference<deleter_type>::type&&)): Likewise.
	(unique_ptr(unique_ptr<_Up, _Ep>&&)): Likewise.
	(operator=(unique_ptr<_Up, _Ep>&&)): Likewise, and add
	is_assignable as a constraint (array version).
	(reset(_Up)): Turn into a template, constrain with array
	convertibility.
	(reset(nullptr_t)): New.
	* testsuite/20_util/default_delete/48631_neg.cc: Adjust.
	* testsuite/20_util/unique_ptr/assign/48635.cc: Likewise.
	* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/assign/cv_qual.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/cv_qual.cc: Likewise.
	* testsuite/20_util/unique_ptr/dr2228.cc: New.
	* testsuite/20_util/unique_ptr/modifiers/cv_qual.cc: Adjust.

From-SVN: r226733
2015-08-08 14:07:34 +03:00
Jonathan Wakely 93411db8c7 re PR libstdc++/67078 (FAIL: 24_iterators/container_access.cc (test for excess errors) on aarch64-none-elf)
PR libstdc++/67078
	* include/bits/range_access.h (size, empty, data): Fix _N bad name.

From-SVN: r226515
2015-08-03 16:56:17 +01:00
Tim Shen 81b7ff079a regex_automaton.h (_State_base, _State<>): Remove _TraitsT dependency from _State<>...
* include/bits/regex_automaton.h (_State_base, _State<>):
	Remove _TraitsT dependency from _State<>; Make matcher member
	into the union to reduce struct size.
	* include/bits/regex_automaton.tcc (_State_base<>::_M_print,
	_State_base<>::_M_dot, _StateSeq<>::_M_clone):
	Adjust to fit the interface. Factor out common parts in
	_M_clone as _State<>::_M_has_alt.
	* include/bits/regex_executor.h (_Executer<>::_M_lookahead):
	Only pass state id instead of the whole state.
	* include/bits/regex_executor.tcc (_Executer<>::_M_dfs,
	_Executer<>::_M_lookahead): Adjust to fit the interface.
	* include/std/regex: Include <ext/aligned_buffer.h>

From-SVN: r226395
2015-07-30 10:35:45 +00:00
Jonathan Wakely 2e3f48dc43 any (any::operator=(const any&)): Check for self-assignment.
* include/experimental/any (any::operator=(const any&)): Check for
	self-assignment.
	* testsuite/experimental/any/assign/self.cc: New.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error.

From-SVN: r226393
2015-07-30 11:00:39 +01:00
Ville Voutilainen a460d06d16 range_access.h: Change class to typename in every template.
2015-07-29  Ville Voutilainen  <ville.voutilainen@gmail.com>

	* include/bits/range_access.h: Change class to typename in every
	template.
	(size, empty, data): New functions from N4280.
	* testsuite/24_iterators/container_access.cc: New.

From-SVN: r226348
2015-07-29 13:41:32 +01:00
Ville Voutilainen 1fa9ba224e re PR libstdc++/60970 (Support std::hash with enum types (LWG 2148))
2015-07-29  Ville Voutilainen  <ville.voutilainen@gmail.com>

	PR libstdc++/60970
	* include/bits/functional_hash.h (__hash_enum): New.
	(hash): Derive from __hash_enum.
	* testsuite/20_util/hash/60970.cc: New.

From-SVN: r226347
2015-07-29 13:41:23 +01:00
Tim Shen f9ce3c1639 re PR libstdc++/67015 ("^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled)
PR libstdc++/67015
	* include/bits/regex_compiler.h (_Compiler<>::_M_expression_term,
	_BracketMatcher<>::_M_add_collating_element): Change signature
	to make checking the and of bracket expression easier.
	* include/bits/regex_compiler.tcc (_Compiler<>::_M_expression_term):
	Treat '-' as a valid literal if it's at the end of bracket expression.
	* testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
	New testcases.

From-SVN: r226336
2015-07-29 03:45:35 +00:00
Jonathan Wakely fa0ed2b062 * include/bits/atomic_futex.h [_GLIBCXX_HAVE_LINUX_FUTEX]
(_M_load_and_test_until): Whitespace.
	(_M_load_and_test): Value-initialize the unused durations.
	(_M_load_when_equal): Add missing return value.

From-SVN: r226174
2015-07-24 17:30:04 +01:00
Michael Haubenwallner 74b7ec8c45 libstdc++-v3/fragment.am (AM_CPPFLAGS): Add CPPFLAGS
2015-07-24  Michael Haubenwallner  <michael.haubenwallner@ssi-schaefer.com>

	* fragment.am (AM_CPPFLAGS): Add CPPFLAGS.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
	* 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++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r226138
2015-07-24 07:05:19 +00:00
DJ Delorie 8161e0c343 functional_hash.h: Add specializations for __intN types.
* include/bits/functional_hash.h: Add specializations for __intN
types.

* include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp (__gnu_pbds):
Guard against values that might exceed size_t's precision.

From-SVN: r226117
2015-07-23 13:57:34 -04:00
Jason Merrill 3a353ff584 * include/bits/c++config: Fix abi_tag in special modes.
From-SVN: r226022
2015-07-20 18:39:54 -04:00
François Dumont 5bc1c07c4a stl_algobase.h (__miter_base): Move...
2015-07-16  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_algobase.h (__miter_base): Move...
	* include/bits/cpp_type_traits.h: ...here.
	* include/debug/functions.h (__foreign_iterator_aux): Use latter.
	* testsuite/23_containers/vector/debug/insert7_neg.cc: New.

From-SVN: r225902
2015-07-16 19:17:26 +00:00
Jonathan Wakely c5d9ec5670 c++config (_GLIBCXX_NOEXCEPT_IF): Define.
* include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Define.
	* include/bits/forward_list.h (forward_list::swap): Make noexcept
	unconditional.
	* include/bits/hashtable.h (_Hashtable::swap): Do not use
	_S_nothrow_swap().
	* include/bits/stl_bvector.h (vector<bool>::swap): Make noexcept
	unconditional.
	* include/bits/stl_deque.h (deque::swap): Likewise.
	(swap(deque&, deque&)): Use _GLIBCXX_NOEXCEPT_IF.
	* include/bits/stl_list.h (list::swap): Make noexcept unconditional.
	(swap(list&, list&)): Use _GLIBCXX_NOEXCEPT_IF.
	* include/bits/stl_map.h (map::swap, swap(map&, map&)): Use
	_GLIBCXX_NOEXCEPT_IF, do not depend on _S_nothrow_swap.
	* include/bits/stl_multimap.h (multimap::swap,
	swap(multimap&, multimap&)): Likewise.
	* include/bits/stl_multiset.h (multiset::swap,
	swap(multiset&, multiset&)): Likewise.
	* include/bits/stl_set.h (set::swap, swap(set&, set&)): Likewise.
	* include/bits/stl_tree.h (_Rb_tree::swap,
	swap(_Rb_tree&, _Rb_tree&)): Likewise.
	* include/bits/stl_vector.h (vector::swap): Make noexcept
	unconditional.
	(swap(vector&, vector&)): Use _GLIBCXX_NOEXCEPT_IF.
	* include/debug/deque (deque::swap, swap): Likewise.
	* include/debug/forward_list (swap): Add noexcept.
	* include/debug/list (list::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
	* include/debug/map.h (map::swap, swap): Likewise.
	* include/debug/multimap.h (multimap::swap, swap): Likewise.
	* include/debug/multiset.h (multiset::Swap, swap): Likewise.
	* include/debug/set.h (set::swap, swap): Likewise.
	* include/debug/unordered_map (unordered_map::swap,
	unordered_multimap::swap, swap): Likewise.
	* include/debug/unordered_set (unordered_set::swap,
	unordered_multiset::swap, swap): Likewise.
	* include/debug/vector (vector::swap, swap): Likewise.
	* include/ext/alloc_traits.h (__alloc_traits::_S_nothrow_swap()):
	Remove.
	* include/profile/deque (deque::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
	* include/profile/forward_list (swap): Add noexcept.
	* include/profile/list (list::swap, swap) : Use _GLIBCXX_NOEXCEPT_IF.
	* include/profile/map.h (map::swap, swap): Likewise.
	* include/profile/multimap.h (multimap::swap, swap): Likewise.
	* include/profile/multiset.h (multiset::swap, swap): Likewise.
	* include/profile/set.h (set::swap, swap): Likewise.
	* include/profile/unordered_map (swap): Likewise.
	* include/profile/unordered_set (swap): Likewise.
	* include/profile/vector (vector::swap, swap): Likewise. Remove
	overloads for swapping rvalues.
	* testsuite/23_containers/deque/allocator/noexcept.cc: Update tests
	for noexcept on swap.
	* testsuite/23_containers/forward_list/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/list/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/map/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/multimap/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/multiset/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/set/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/vector/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/vector/bool/allocator/noexcept.cc: Likewise.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error line
	number.

From-SVN: r225744
2015-07-13 18:15:48 +01:00
François Dumont 291e91daa7 hashtable.h (_Hashtable<>::__rehash_policy): Do not rehash container.
2015-07-05  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/hashtable.h (_Hashtable<>::__rehash_policy): Do not
	rehash container.
	* testsuite/23_containers/unordered_set/max_load_factor/robustness.cc:
	Adapt.

From-SVN: r225436
2015-07-05 21:16:07 +00:00
Ville Voutilainen e37e6813d5 Implement std::experimental::fundamentals_v2::propagate_const.
2015-07-03  Ville Voutilainen  <ville.voutilainen@gmail.com>

	Implement std::experimental::fundamentals_v2::propagate_const.
	* include/Makefile.am: Add propagate_const.
	* include/Makefile.in: Regenerate.
	* include/experimental/propagate_const: New.
	* testsuite/experimental/propagate_const/assignment/copy.cc: Likewise.
	* testsuite/experimental/propagate_const/assignment/move.cc: Likewise.
	* testsuite/experimental/propagate_const/assignment/move_neg.cc:
	Likewise.
	* testsuite/experimental/propagate_const/cons/copy.cc: Likewise.
	* testsuite/experimental/propagate_const/cons/default.cc: Likewise.
	* testsuite/experimental/propagate_const/cons/move.cc: Likewise.
	* testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
	* testsuite/experimental/propagate_const/hash/1.cc: Likewise.
	* testsuite/experimental/propagate_const/observers/1.cc: Likewise.
	* testsuite/experimental/propagate_const/relops/1.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements1.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.
	* testsuite/experimental/propagate_const/swap/1.cc: Likewise.
	* testsuite/experimental/propagate_const/typedefs.cc: Likewise.

From-SVN: r225379
2015-07-03 15:08:37 +01:00
Jonathan Wakely 7946683835 alloc_traits.h (__alloctr_rebind): Remove.
* include/bits/alloc_traits.h (__alloctr_rebind): Remove.
	(__allocator_traits_base): New base class.
	(__alloc_rebind): Reimplement in terms of detection idiom.
	(allocator_traits): Derive from __allocator_traits_base. Reimplement
	nested types in terms of detection idiom. Simplify SFINAE constraints
	on overloaded static member functions.
	* include/bits/hashtable.h (_Hashtable): Use __alloc_rebind instead
	of __alloctr_rebind.
	* testsuite/20_util/scoped_allocator/propagation.cc: Define rebind.
	* testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust
	dg-error line number.

From-SVN: r225244
2015-07-01 13:24:09 +01:00
Jonathan Wakely 4f44c5556f ptr_traits.h (__ptrtr_elt_type, [...]): Remove
* include/bits/ptr_traits.h (__ptrtr_elt_type, __ptrtr_diff_type,
	__ptrtr_rebind, __ptrtr_not_void): Remove
	(__get_first_arg, __replace_first_arg, __make_not_void): Define new
	transformations.
	(__detected_or_): New detection trait.
	(pointer_traits): Use new traits.
	* testsuite/20_util/pointer_traits/pointer_to.cc: Add rebind member.
	* testsuite/20_util/pointer_traits/requirements/
	explicit_instantiation.cc: Use valid arguments to pointer_traits.

From-SVN: r225243
2015-07-01 13:24:03 +01:00
Jonathan Wakely 6af6bef4ac Implement N4502, the C++ Detection Idiom.
* doc/xml/manual/status_cxx2017.xml: Update status table.
	* include/experimental/type_traits (void_t, is_detected,
	is_detected_v, detected_t, detected_or, detected_or_t,
	is_detected_exact, is_detected_exact_v, is_detected_convertible,
	is_detected_convertible_v): Define.
	* include/std/type_traits (__detector, __detected_or, __detected_or_t,
	__detected_or_t_): Define.
	* testsuite/experimental/type_traits/detection.cc: New.

From-SVN: r225242
2015-07-01 13:23:54 +01:00
Jonathan Wakely 6f86467975 * include/bits/stl_pair.h: Replace class keyword with typename.
From-SVN: r225190
2015-06-30 14:35:36 +01:00
Ville Voutilainen bf7818bfb0 Implement N4387, "Improving pair and tuple", and LWG 2367.
2015-06-30  Ville Voutilainen  <ville.voutilainen@gmail.com>

	Implement N4387, "Improving pair and tuple", and LWG 2367.

	* include/bits/stl_pair.h (_ConstructiblePair,
	_ImplicitlyConvertiblePair, _MoveConstructiblePair,
	_ImplicitlyMoveConvertiblePair): New.
	(pair()): Constrain it.
	(pair(const _T1&, const _T2&), pair(const pair<_U1, _U2>&),
	pair(_U1&&, const _T2&), pair(const _T1&, _U2&&), pair(_U1&&, _U2&&),
	pair(pair<_U1, _U2>&&)): Make conditionally explicit.
	* include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New.
	(tuple()): Constrain it.
	(tuple(const _UElements&...), tuple(_UElements&&...),
	tuple(const tuple<_UElements...>&), tuple(tuple<_UElements...>&&),
	tuple(allocator_arg_t, const _Alloc&, const _UElements&...),
	tuple(allocator_arg_t, const _Alloc&, _UElements&&...),
	tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&),
	tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&),
	tuple(const pair<_U1, _U2>&), tuple(pair<_U1, _U2>&&),
	tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&),
	tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make
	conditionally explicit.
	* include/experimental/functional (__boyer_moore_array_base): Name
	array type explicitly instead of using an empty braced-init-list.
	* testsuite/20_util/pair/cons/explicit_construct.cc: New.
	* testsuite/20_util/pair/piecewise.cc: Use piecewise_construct.
	* testsuite/20_util/pair/requirements/dr2367.cc: New.
	* testsuite/20_util/tuple/cons/explicit_construct.cc: New.
	* testsuite/20_util/tuple/requirements/dr2367.cc: New.

From-SVN: r225189
2015-06-30 14:26:49 +01:00
François Dumont 24167c42e6 stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
	to pre-C++11 mode.
	* include/debug/functions.h
	(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
	* include/debug/safe_iterator.h
	(__gnu_debug::_Sequence_traits): New.
	(__gnu_debug::__get_distance_from_begin): New.
	(__gnu_debug::__get_distance_to_end): New.
	(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
	distance information. Add optional check_dereferenceable parameter,
	default true.
	(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
	default definition...
	(__gnu_debug::__get_distance): New overload for _Safe_iterator.
	(__gnu_debug::__unsafe): Likewise.
	* include/debug/helper_functions.h: ...here. New.
	(__gnu_debug::__unsafe): New helper function to remove safe iterator
	layer.
	* include/debug/stl_iterator.h: New. Include latter.
	* include/bits/stl_iterator.h: Include latter in debug mode.
	* include/debug/stl_iterator.tcc: Adapt.
	* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
	overload for _Safe_local_iterator.
	(__gnu_debug::__unsafe): Likewise.
	* include/debug/safe_local_iterator.tcc: Adapt.
	* include/debug/macros.h (__glibcxx_check_valid_range2): New.
	(__glibcxx_check_insert_range): Add _Dist parameter.
	(__glibcxx_check_insert_range_after): Likewise.
	(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
	_GLIBCXX_DEBUG_PEDASSERT.
	* include/debug/deque (deque<>::assign): Remove iterator debug layer
	when possible.
	(deque<>::insert): Likewise.
	* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
	(forward_list<>::splice_after): Use latter.
	(forward_list<>::assign): Remove iterator debug layer when possible.
	(forward_list<>::insert_after): Likewise.
	(__gnu_debug::_Sequence_traits<>): Partial specialization.
	* include/debug/list (list<>::assign): Remove iterator debug layer when
	possible.
	(list<>::insert): Likewise.
	[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
	* include/debug/map.h (map<>::insert): Remove iterator debug layer when
	possible.
	* include/debug/multimap.h (multimap<>::insert): Likewise.
	* include/debug/set.h (set<>::insert): Likewise.
	* include/debug/multiset.h (multiset<>::insert): Likewise.
	* include/debug/string (basic_string<>::append, basic_string<>::assign,
	basic_string<>::insert, basic_string<>::replace): Likewise.
	* include/debug/unordered_map
	(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
	* include/debug/unordered_set
	(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
	* include/debug/vector
	(vector<>::assign, vector<>::insert): Likewise.
	* include/Makefile.am: Add new debug headers.
	* include/Makefile.in: Regenerate.

From-SVN: r225143
2015-06-29 20:17:56 +00:00
Jonathan Wakely a2b5fdcbdb Implement N4258 (Cleaning-up noexcept in the Library rev 3)
* doc/xml/manual/intro.xml: Document LWG 2108 status.
	* include/bits/alloc_traits.h (allocator_traits::is_always_equal):
	Define.
	* include/bits/allocator.h (allocator::is_always_equal): Likewise.
	* include/bits/forward_list.h
	(forward_list::operator=(forward_list&&)): Use __bool_constant.
	(forward_list::swap(forward_list&)): Add noexcept.
	* include/bits/hashtable.h (_Hashtable::operator=(_Hashtable&&)):
	Likewise.
	(_Hashtable::swap(_Hashtable&)): Likewise.
	* include/bits/stl_deque.h (_Deque_base::_Deque_base(_Deque_base&&)):
	Use _Alloc_traits::is_always_equal.
	(deque::operator=(deque&&)): Likewise.
	(deque::_M_move_assign1(deque&&, false_type)): Add comment and use
	__bool_constant.
	(swap(deque&, deque&)): Add noexcept.
	* include/bits/stl_list.h (list::operator=(list&&)): Use
	__bool_constant.
	(swap(list&, list&)): Add noexcept.
	* include/bits/stl_map.h (map::swap(map&)): Include _Compare in
	noexcept.
	(swap(map&, map&)): Add noexcept.
	* include/bits/stl_multimap.h (multimap::swap(multimap&)): Include
	_Compare in noexcept.
	(swap(multimap&, multimap&)): Add noexcept.
	* include/bits/stl_multiset.h (multiset::swap(multiset&)): Include
	_Compare in noexcept.
	(swap(multiset&, multiset&)): Add noexcept.
	* include/bits/stl_set.h (set::swap(set&)): Include _Compare in
	noexcept.
	(swap(set&, set&)): Add noexcept.
	* include/bits/stl_tree.h (_Rb_tree::operator=(_Rb_tree&&)): Include
	_Compare in noexcept.
	(_Rb_tree::_Rb_tree(_Rb_tree&&, _Node_alloc_type&&)): Use
	is_always_equal.
	* include/bits/stl_vector.h (vector::operator=(vector&&)): Use
	__bool_constant.
	(swap(vector&, vector&)): Add noexcept.
	* include/bits/unordered_map.h (swap(unordered_map&, unordered_map&),
	swap(unordered_multimap& unordered_multimap&)): Add noexcept.
	* include/bits/unordered_set.h (swap(unordered_set&, unordered_set&),
	swap(unordered_multiset& unordered_multiset&)): Add noexcept.
	* include/ext/alloc_traits.h (__allocator_always_compares_equal):
	Remove.
	(__alloc_traits::_S_always_equal()): Use is_always_equal instead of
	__allocator_always_compares_equal.
	* include/ext/array_allocator.h (array_allocator::is_always_equal):
	Define.
	* include/std/scoped_allocator (__any_of, __propagate_on_copy,
	__propagate_on_move, __propagate_on_swap): Remove.
	(scoped_allocator_adaptor::propagate_on_container_copy_assignment,
	scoped_allocator_adaptor::propagate_on_container_move_assignment,
	scoped_allocator_adaptor::propagate_on_container_swap): Define with
	__and_ instead of __any_of.
	(scoped_allocator_adaptor::is_always_equal): Define.
	* testsuite/20_util/allocator_traits/members/is_always_equal.cc: New.
	* testsuite/20_util/scoped_allocator/propagation.cc: Make traits
	derive from true_type or false_type.
	* testsuite/23_containers/deque/allocator/move_assign-2.cc: Add
	is_always_equal member and remove the trait specialization.
	* testsuite/23_containers/vector/52591.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
	Likewise.

From-SVN: r225081
2015-06-26 21:10:24 +01:00
Jonathan Wakely 504a5fe6fd stl_bvector.h (vector<bool>::vector()): Add noexcept.
* include/bits/stl_bvector.h (vector<bool>::vector()): Add noexcept.
	* include/bits/stl_map.h (map::map()): Likewise.
	* include/bits/stl_multimap.h (multimap::multimap()): Likewise.
	* include/bits/stl_multiset.h (multiset::multiset()): Likewise.
	* include/bits/stl_set.h (set::set()): Likewise.

From-SVN: r225024
2015-06-26 18:26:38 +01:00
Jonathan Wakely 67b0404e12 * include/bits/locale_conv.h (__do_str_codecvt): Set __count.
From-SVN: r224985
2015-06-25 19:23:41 +01:00
François Dumont e25d2617ac basic_string.h (basic_string<>::front()): Add !empty debug check.
2015-06-24  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/basic_string.h (basic_string<>::front()): Add !empty
	debug check.
	(basic_string<>::back()): Likewise.
	(basic_string<>::pop_back()): Likewise.

From-SVN: r224919
2015-06-24 20:12:05 +00:00
François Dumont 7d17de7f73 array: Include <array>.
2015-06-23  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/array: Include <array>. Add version namespace when
	specializing tuple interface to array. Add specialization for
	__is_tuple_like_impl.
	* include/profile/array: Likewise.
	* include/std/array: Include <utility>. Add specialization for
	__is_tuple_like_impl.
	* include/std/tuple
	(__is_tuple_like_impl<>, __is_tuple_like_impl<pair>): Move...
	* include/std/utility: ... here. Include <type_traits>.
	* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adjust
	dg-error line number.
	* testsuite/23_containers/array/tuple_interface/
	tuple_element_debug_neg.cc: Likewise.

From-SVN: r224857
2015-06-23 19:51:02 +00:00
Jonathan Wakely e51d877098 list (__gnu_debug::list): Use allocator-aware _Safe_container base.
* include/debug/list (__gnu_debug::list): Use allocator-aware
	_Safe_container base.
	* include/debug/string (__gnu_debug::basic_string): Use
	allocator-aware _Safe_container base for cxx11 ABI.

From-SVN: r224738
2015-06-22 16:09:27 +01:00
Jonathan Wakely 9eb659e003 locale_conv.h (__do_str_codecvt): Handle empty range.
* include/bits/locale_conv.h (__do_str_codecvt): Handle empty range.
	(wstring_convert): Move into __cxx11 namespace.
	(wbuffer_convert(streambuf*, _Codecvt*, state_type)): Fix exception
	message.

From-SVN: r224737
2015-06-22 16:09:22 +01:00
Jonathan Wakely 4db6c2f585 re PR libstdc++/64657 (Support iterators with overloaded operator-comma)
PR libstdc++/64657
	* include/bits/stl_uninitialized.h
	(__uninitialized_copy::__uninit_copy): Cast expression to void.

From-SVN: r224736
2015-06-22 16:09:14 +01:00
Jonathan Wakely cc7f3d0eee C++11 allocator support for std::list.
PR libstdc++/55409
	* include/bits/list.tcc (_List_base::_M_clear()): Use allocator traits.
	(list::list(const list&)): Use allocator propagation trait. Use
	_M_assign_dispatch to copy elements.
	* include/bits/stl_list.h (_List_node): Use __aligned_membuf in C++11.
	(_List_node::_M_valptr()): Add accessor for stored value.
	(_List_iterator, _List_const_iterator, _List_base): Use _M_valptr().
	(_List_base, list): Use allocator traits.
	(_List_base::_M_get_Tp_allocator, _List_base::get_allocator): Remove.
	(_List_base::_M_move_nodes): New function.
	(_List_base(_List_base&&)): Use _M_move_nodes.
	(_List_base(_List_base&&, _Node_alloc_type&&)): New constructor.
	(list::_M_create_node, list::_M_erase, list::max_size): Use allocator
	traits.
	(list(size_type)): Add allocator parameter.
	(list(const list&)): Use allocator propagation trait.
	(list(const list&, const allocator_type&)): New constructor.
	(list(list&&, const allocator_type&)): Likewise.
	(list::operator=(list&&), list::swap(list&)): Use allocator
	propagation traits.
	(list::_M_move_assign): New functions.
	* include/debug/list: Add allocator-extended constructors.
	* include/profile/list: Likewise.
	* python/libstdcxx/v6/printers.py (get_value_from_list_node): New
	function to get value from _List_node.
	(StdListPrinter): Use get_value_from_list_node.
	* testsuite/23_containers/list/allocator/copy.cc: New.
	* testsuite/23_containers/list/allocator/copy_assign.cc: New.
	* testsuite/23_containers/list/allocator/minimal.cc: New.
	* testsuite/23_containers/list/allocator/move.cc: New.
	* testsuite/23_containers/list/allocator/move_assign.cc: New.
	* testsuite/23_containers/list/allocator/noexcept.cc: New.
	* testsuite/23_containers/list/allocator/swap.cc: New.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Adjust dg-prune-output line number.
	* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Likewise.

From-SVN: r224580
2015-06-17 21:36:42 +01:00
Jonathan Wakely 21bdef94b1 forward_list.h (_Fwd_list_base(const _Node_alloc_type&)): Change parameter to rvalue-reference.
* include/bits/forward_list.h
	(_Fwd_list_base(const _Node_alloc_type&)): Change parameter to
	rvalue-reference.
	(_Fwd_list_base(_Fwd_list_base&&, const _Node_alloc_type&)): Likewise.
	(forward_list(const _Alloc&)): Split default constructor out to
	separate function.
	(forward_list(forward_list&&, const _Alloc&)): Move elements if base
	class didn't do so.
	(forward_list::_M_move_assign(forward_list&&, true_type)): Replace
	swap call with two assignments.
	* include/bits/forward_list.tcc
	(_Fwd_list_base(_Fwd_list_base&&, const _Node_alloc_type&)): Don't
	move elements when allocators are not equal.
	* include/debug/forward_list (forward_list(const allocator_type&)):
	Split default constructor out to separate function.
	* include/profile/forward_list (forward_list(const _Alloc&)):
	Likewise.

From-SVN: r224566
2015-06-17 18:45:45 +01:00
Jonathan Wakely 9649e5b62e forward_list.h (forward_list::_M_get_Node_allocator): Remove unnecessary uses of operator& and static_cast.
* include/bits/forward_list.h (forward_list::_M_get_Node_allocator):
	Remove unnecessary uses of operator& and static_cast.
	* include/bits/forward_list.tcc
	(forward_list::operator=(const forward_list&)): Use __addressof
	instead of operator&.
	(forward_list::remove(const _Tp&), forward_list::remove(_Pred)):
	Remove invalid static_casts.
	* include/debug/forward_list: Use __addressof instead of operator&.
	* testsuite/23_containers/forward_list/modifiers/addressof.cc: New.

From-SVN: r224553
2015-06-17 12:33:31 +01:00
Jonathan Wakely c92334d4c5 alloc_traits.h (__alloc_traits::_S_nothrow_swap()): Use __is_nothrow_swappable.
* include/ext/alloc_traits.h (__alloc_traits::_S_nothrow_swap()): Use
	__is_nothrow_swappable.

From-SVN: r224552
2015-06-17 11:51:46 +01:00
Jonathan Wakely 91b142ffc3 * include/bits/allocated_ptr.h (__allocated_ptr): Use __addressof.
From-SVN: r224540
2015-06-16 23:33:06 +01:00
Jonathan Wakely 200fcd3398 list.tcc (list::operator=(const list&), [...]): Use __addressof instead of operator&.
* include/bits/list.tcc (list::operator=(const list&), list::merge):
	Use __addressof instead of operator&.
	(list::sort): Use array-to-pointer decay instead of operator&.
	* include/bits/stl_list.h (list::splice): Use __addressof instead of
	operator&.
	* include/debug/formatter.h (_Error_formatter::_Parameter::_Parameter):
	Likewise.
	* include/debug/functions.h (__check_singular): Likewise.
	* include/debug/list (list::splice, list::merge): Likewise.
	* testsuite/23_containers/list/modifiers/addressof.cc: New.

From-SVN: r224539
2015-06-16 22:04:53 +01:00
Jonathan Wakely 7388ee9e9b * include/precompiled/stdc++.h: Include <codecvt> and <shared_mutex>.
From-SVN: r224425
2015-06-12 13:27:06 +01:00
Ramana Radhakrishnan 57e6d9be77 Use atomics in guard.cc.
This provides proper definitions for _GLIBCXX_READ_MEM_BARRIER and
_GLIBCXX_WRITE_MEM_BARRIER, rewrites the guards in terms of proper
atomic extensions and removes internal uses of
_GLIBCXX_READ_MEM_BARRIER and _GLIBCXX_WRITE_MEM_BARRIER and replaces
them with equivalent atomics.

2015-06-12  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

	PR target/66200
	PR c++/66192
	* * config/cpu/generic/atomic_word.h (_GLIBCXX_READ_MEM_BARRIER): Define
        (_GLIBCXX_WRITE_MEM_BARRIER): Likewise
        * include/bits/shared_ptr_base.h: Use ACQ_REL barrier.
        * include/ext/atomicity.h: Likewise.
        * include/tr1/shared_ptr.h: Likewise.
        * libsupc++/guard.cc (__test_and_acquire): Rewrite with atomics.
        Update comment.
        (__set_and_release): Likewise.
        * testsuite/20_util/shared_ptr/cons/43820_neg.cc (test01): Adjust for
	line numbers.
        * testsuite/20_util/shared_ptr/cons/void_neg.cc: Likewise.
        * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc:
	Likewise.

From-SVN: r224411
2015-06-12 09:49:41 +00:00
Jonathan Wakely 7672ab25db tuple (__is_tuple_like_impl): Disambiguate array in debug and profile modes.
* include/std/tuple (__is_tuple_like_impl): Disambiguate array in
	debug and profile modes.
	* testsuite/25_algorithms/headers/algorithm/synopsis.cc: Adjust tests
	for swap in C++11 and later.

From-SVN: r224397
2015-06-12 00:22:19 +01:00
Jonathan Wakely c00f4f5fb3 re PR libstdc++/66441 (wstring_convert not working correctly)
PR libstdc++/66441
	* testsuite/22_locale/conversions/string/66441.cc: New.
	* include/bits/locale_conv.h (__do_str_codecvt): Reserve enough space
	in the output string for BOM and complete result.

From-SVN: r224222
2015-06-08 14:03:45 +01:00