Commit Graph

9398 Commits

Author SHA1 Message Date
Jonathan Wakely
92805612f4 PR 70101 fix allocator-extended ctors for std::priority_queue
PR libstdc++/70101
	* include/bits/stl_queue.h (priority_queue): Fix allocator-extended
	constructors.
	* testsuite/23_containers/priority_queue/allocator.cc: New test.

From-SVN: r240781
2016-10-05 13:01:57 +01:00
Jonathan Wakely
a2a64b499a 77864 Fix noexcept conditions for map/set default constructors
PR libstdc++/77864
	* include/bits/stl_map.h (map::map()): Use nothrow constructibility
	of comparison function in conditional noexcept.
	* include/bits/stl_multimap.h (multimap::multimap()): Likewise.
	* include/bits/stl_multiset.h (multiset::multiset()): Likewise.
	* include/bits/stl_set.h (set::set()): Likewise.
	* testsuite/23_containers/map/cons/noexcept_default_construct.cc:
	New test.
	* testsuite/23_containers/multimap/cons/noexcept_default_construct.cc:
	Likewise.
	* testsuite/23_containers/multiset/cons/noexcept_default_construct.cc:
	Likewise.
	* testsuite/23_containers/set/cons/noexcept_default_construct.cc:
	Likewise.

From-SVN: r240780
2016-10-05 13:01:51 +01:00
Jonathan Wakely
d72d690a92 Remove invalid alias declaration from _Node_handle
* include/bits/node_handle.h (_Node_handle): Remove invalid and unused
	alias declaration.

From-SVN: r240779
2016-10-05 13:01:44 +01:00
Jonathan Wakely
78ec9c15be PR 70564 disambiguate constructors for not_fn call wrapper
PR libstdc++/70564
	* include/experimental/functional (_Not_fn): Remove.
	(not_fn): Use std::_Not_fn.
	* include/std/functional (_Not_fn): Add second parameter to
	disambiguate copying from initialization by not_fn. Define for C++14.
	(not_fn): Add second argument to initialization.
	* testsuite/20_util/not_fn/1.cc: Copy call wrapper using
	direct-initialization.

From-SVN: r240778
2016-10-05 13:01:36 +01:00
François Dumont
38aee22c7d shared_ptr.cc (mask, [...]): Move declaration...
2016-10-03  François Dumont  <fdumont@gcc.gnu.org>

	* src/c++11/shared_ptr.cc (mask, invalid, get_mutex): Move
	declaration...
	* src/c++11/mutex_pool.h: ... here. New.
	* src/c++11/debug.cc: Use latter.

From-SVN: r240732
2016-10-03 20:23:13 +00:00
Jonathan Wakely
606dda21c8 Define std::gcd and std::lcm for C++17
* doc/xml/manual/status_cxx2017.xml: Update gcd/lcm status.
	* doc/html/*: Regenerate.
	* include/experimental/numeric (__abs): Move to <numeric>.
	(gcd, lcm): Use __detail::gcd and __detail::lcm.
	* include/std/numeric (__detail::__abs_integral)
	(__detail::__gcd, __detail::__lcm): Define.
	(gcd, lcm): Define for C++17.
	* testsuite/26_numerics/gcd/1.cc: New test.
	* testsuite/26_numerics/lcm/1.cc: New test.
	* testsuite/experimental/numeric/gcd.cc: Swap contents with ...
	* testsuite/experimental/numeric/lcd.cc: ... this.

From-SVN: r240723
2016-10-03 18:01:10 +01:00
Jonathan Wakely
e347987da8 Fix libstdc++ versioned namespace build
PR libstdc++/68323
	PR libstdc++/77794
	* config/abi/pre/gnu-versioned-namespace.ver: Add exports for
	__cxa_thread_atexit and __gnu_cxx::__freeres.
	* include/Makefile.am: Add <experimental/bits/lfts_config.h>
	* include/Makefile.in: Regenerate.
	* include.bits/basic_string.h: Fix nesting of versioned namespaces.
	* include/bits/c++config: Declare versioned namespaces for literals.
	* include/bits/regex.h (basic_regex, match_results): Add workarounds
	for PR c++/59256.
	* include/bits/uniform_int_dist.h: Fix nesting of versioned namespace.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/std/string_view: Likewise.
	* include/std/variant: Likewise. Add workaround for PR c++/59256.
	* include/experimental/bits/fs_fwd.h: Declare versioned namespace.
	* include/experimental/bits/lfts_config.h: Declare versioned
	namespaces.
	* include/experimental/algorithm: Include
	<experimental/bits/lfts_config.h>.
	* include/experimental/any: Likewise.
	* include/experimental/bits/erase_if.h: Likewise.
	* include/experimental/chrono: Likewise.
	* include/experimental/functional: Likewise.
	* include/experimental/memory_resource: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/random: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/system_error: Likewise.
	* include/experimental/tuple: Likewise.
	* include/experimental/type_traits: Likewise.
	* include/experimental/utility: Likewise.
	* include/experimental/string_view: Likewise. Fix nesting of
	versioned namespaces.
	* include/experimental/bits/string_view.tcc: Reopen inline namespace
	for non-inline function definitions.
	* testsuite/17_intro/using_namespace_std_exp_neg.cc: New test.
	* testsuite/20_util/duration/literals/range.cc: Adjust dg-error line.
	* testsuite/experimental/any/misc/any_cast_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.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Likewise.

From-SVN: r240714
2016-10-03 15:35:28 +01:00
Jonathan Wakely
6a0d23af49 Ensure "C++" language linkage for std::abs overloads
PR libstdc++/77814
	* include/bits/std_abs.h: Use "C++" language linkage.
	* testsuite/17_intro/headers/c++2011/linkage.cc: Move <complex.h> to
	the end. Add <stdalign.h>.

From-SVN: r240710
2016-10-03 12:50:46 +01:00
Ville Voutilainen
3fe2ddae4b re PR libstdc++/77802 (Boost Fiber doesn't compile)
PR libstdc++/77802
    * testsuite/20_util/tuple/77802.cc: New.

    Revert:
    2016-09-21  Ville Voutilainen  <ville.voutilainen@gmail.com>
    Implement LWG 2729 for tuple.
    * include/std/tuple (_Tuple_impl(_Tuple_impl&&)):
    Suppress conditionally.
    (_Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&&)): Likewise.
    (__is_tuple_impl_trait_impl, __is_tuple_impl_trait): New.
    (_Tuple_impl(const _Head&)): Constrain.
    (_Tuple_impl(_UHead&&)): Likewise.
    (_Tuple_impl(_Tuple_impl&&)): Suppress conditionally.
    (_Tuple_impl(const _Tuple_impl<_Idx, _UHead>&)): Constrain.
    (_Tuple_impl(_Tuple_impl<_Idx, _UHead>&&)): Likewise.
    (operator=(const tuple&)): Enable conditionally.
    (operator=(tuple&&)): Suppress conditionally.
    (operator=(const tuple<_UElements...>&)): Constrain.
    (operator=(tuple<_UElements...>&&)): Likewise.
    (operator=(const tuple&)): Enable conditionally (2-param tuple).
    (operator=(tuple&&)): Suppress conditionally (2-param tuple).
    (operator=(const tuple<_U1, _U2>&)): Constrain.
    (operator=(tuple<_U1, _U2>&&)): Likewise.
    (operator=(const pair<_U1, _U2>&)): Likewise.
    (operator=(pair<_U1, _U2>&&)): Likewise.
    * testsuite/20_util/tuple/element_access/get_neg.cc: Adjust.
    * testsuite/20_util/tuple/tuple_traits.cc: New.

From-SVN: r240709
2016-10-03 14:06:53 +03:00
Jonathan Wakely
36105dbdab libstdc++/77795 Only declare ::gets for C++98 and C++11
PR libstdc++/77795
	* acinclude.m4 (GLIBCXX_CHECK_STDIO_PROTO): Use -std=gnu++11 to check
	for gets.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/c_global/cstdio [!_GLIBCXX_HAVE_GETS] (gets): Only declare
	for C++98 and C++11.
	* include/c_std/cstdio [!_GLIBCXX_HAVE_GETS] (gets): Likewise.
	* testsuite/27_io/headers/cstdio/functions_neg.cc: New test.

From-SVN: r240672
2016-09-30 19:28:53 +01:00
Jonathan Wakely
37b204de60 Implement LWG 2192 and LWG 2294 for std::abs
* doc/xml/manual/intro.xml: Document LWG 2192 changes.
	* doc/html/*: Regenerate.
	* include/Makefile.am: Add bits/std_abs.h.
	* include/Makefile.in: Regenerate.
	* include/bits/std_abs.h: New header defining all required overloads
	of std::abs in one place (LWG 2294).
	* include/c_global/cmath (abs(double), abs(float), abs(long double)):
	Move to bits/std_abs.h.
	(abs<_Tp>(_Tp)): Remove.
	* include/c_global/cstdlib (abs(long), abs(long long), abs(__int<N>)):
	Move to bits/std_abs.h.
	* testsuite/26_numerics/headers/cmath/dr2192.cc: New test.
	* testsuite/26_numerics/headers/cmath/dr2192_neg.cc: New test.
	* testsuite/26_numerics/headers/cstdlib/dr2192.cc: New test.
	* testsuite/26_numerics/headers/cstdlib/dr2192_neg.cc: New test.

From-SVN: r240660
2016-09-30 17:07:43 +01:00
Jonathan Wakely
9e28a77462 Remove use of std::abs in experimental::{gcd,lcm}
PR libstdc++/77801
	* include/experimental/numeric: Include <numeric>.
	(__abs): Define.
	(gcd, lcm): Use __abs instead of std::abs.
	* testsuite/experimental/numeric/77801.cc: New test.
	* testsuite/experimental/numeric/gcd.cc: Test unsigned inputs.
	* testsuite/experimental/numeric/lcm.cc: Likewise.

From-SVN: r240656
2016-09-30 14:43:37 +01:00
Ville Voutilainen
a181f67231 Make optional::reset noexcept, make optional::value work in constant expressions.
Make optional::reset noexcept, make optional::value
    work in constant expressions.
    * include/std/optional (_M_get): Make constexpr.
    (reset): Make noexcept.
    * testsuite/20_util/optional/assignment/7.cc: New.
    * testsuite/20_util/optional/observers/6.cc: New.

From-SVN: r240623
2016-09-29 18:20:28 +03:00
Jonathan Wakely
998e01a6d5 Define C++17 std::hypot without _GLIBCXX_USE_C99_MATH_TR1
* include/c_global/cmath (hypot, __hypot3): Move C++17 overloads
	outside _GLIBCXX_USE_C99_MATH_TR1 condition.

From-SVN: r240620
2016-09-29 14:25:48 +01:00
Alan Modra
6d49b790fd Disable .gnu.attributes tags in compatibility-ldbl.o
compatibility-ldbl.o is compiled with -mlong-double-64.  When
long double .gnu.attributes tags are checked by the linker, it
complains about the mismatch between this file and others in
libstdc++.

	* configure.ac (LONG_DOUBLE_COMPAT_FLAGS): New ACSUBST.
	* src/Makefile.am (compatibility-ldbl.o, compatibility-ldbl.lo):
	Use LONG_DOUBLE_COMPAT_FLAGS.
	* Makefile.in: Regenerate.
	* configure: 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: r240602
2016-09-29 07:33:17 +09:30
Jonathan Wakely
b236debd3b * include/std/chrono (system_clock): Fix typo in comment.
From-SVN: r240589
2016-09-28 19:04:23 +01:00
Jonathan Wakely
fd5effb17e Check for overflow in filesystem::last_write_time
* include/experimental/bits/fs_fwd.h (file_time_type): Simplify
	definition.
	* src/filesystem/ops.cc (file_time): Take error_code parameter and
	check for overflow.
	(do_copy_file, last_write_time): Pass error_code in file_time calls.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	New.
	* testsuite/util/testsuite_fs.h (scoped_file): Define RAII helper.

From-SVN: r240587
2016-09-28 19:02:25 +01:00
Jonathan Wakely
1b4be62ad3 libstdc++/77686 use may_alias for std::function storage
PR libstdc++/77686
	* include/std/functional (_Any_data): Add may_alias attribute.

From-SVN: r240567
2016-09-28 11:57:46 +01:00
Jonathan Wakely
4940de303c Define feature macro and update C++17 library status
* doc/xml/manual/status_cxx2017.xml: Update status.
	* doc/html/*: Regenerate.
	* include/std/functional (__cpp_lib_boyer_moore_searcher): Define.
	* testsuite/20_util/function_objects/searchers.cc: Test feature macro.

From-SVN: r240550
2016-09-27 16:39:51 +01:00
Jonathan Wakely
b658669de0 Define 3-argument overloads of std::hypot for C++17 (P0030R1)
* doc/xml/manual/status_cxx2017.xml: Update status.
	* include/c_global/cmath (hypot): Add three-dimensional overloads.
	* testsuite/26_numerics/headers/cmath/hypot.cc: New.

From-SVN: r240547
2016-09-27 16:14:24 +01:00
Ville Voutilainen
71ade764ad re PR libstdc++/77727 (Unwrapping std::optional constructor is not working for non-transferable object)
PR libstdc++/77727
    * include/std/optional (optional(const optional<_Up>&)):
    Default-initialize the base and use emplace.
    (optional(optional<_Up>&&)): Likewise.
    * testsuite/20_util/optional/cons/77727.cc: New.

From-SVN: r240511
2016-09-26 23:51:42 +03:00
François Dumont
f2fe9e0a69 2016-09-26 François Dumont <fdumont@gcc.gnu.org>
* include/debug/safe_base.h
	(_Safe_iterator_base::_M_detach_single): Make public.

From-SVN: r240510
2016-09-26 20:32:39 +00:00
Jonathan Wakely
1a08d2da0e Remove redefinition of __cpp_lib_array_constexpr
* include/bits/range_access.h (__cpp_lib_array_constexpr): Do not
	redefine macro defined in <bits/stl_iterator.h>.

From-SVN: r240488
2016-09-26 11:17:53 +01:00
Jonathan Wakely
976160b962 Add assertions to extract(const_iterator) functions
* include/bits/stl_map.h (map::extract(const_iterator)): Assert that
	iterator is not past-the-end.
	* include/bits/stl_multimap.h (multimap::extract(const_iterator)):
	Likewise.
	* include/bits/stl_multiset.h (multiset::extract(const_iterator)):
	Likewise.
	* include/bits/stl_set.h (set::extract(const_iterator)): Likewise.
	* include/bits/unordered_map.h (unordered_map::extract(const_iterator))
	(unordered_multimap::extract(const_iterator)): Likewise.
	* include/bits/unordered_set.h (unordered_set::extract(const_iterator))
	(unordered_multiset::extract(const_iterator)): Likewise.

From-SVN: r240487
2016-09-26 11:17:48 +01:00
Ville Voutilainen
a38814c003 re PR libstdc++/77717 (testsuite/21_strings/basic_string_view/operations/compare/char/1.cc makes undefined memcmp call)
PR libstdc++/77717
	* testsuite/21_strings/basic_string_view/operations/compare/char/1.cc:
	Fix an out-of-bounds access.

From-SVN: r240486
2016-09-26 12:46:19 +03:00
Marek Polacek
81fea426da Implement -Wimplicit-fallthrough.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r240485
2016-09-26 09:42:50 +00:00
François Dumont
d8bbd665a1 debug.cc: Include debug/vector.
2016-09-25  François Dumont  <fdumont@gcc.gnu.org>

	* src/c++11/debug.cc: Include debug/vector. Include cctype. Remove
	functional.
	(get_safe_base_mutex): Get mutex based on address lowest non nil bits.
	* testsuite/23_containers/vector/debug/mutex_association.cc: New.

From-SVN: r240479
2016-09-25 20:26:02 +00:00
François Dumont
5d04532430 bitset (bitset::reference::reference(const _Base_ref&, bitset*)): Remove __unused__ attribute.
2016-09-25  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/bitset (bitset::reference::reference(const _Base_ref&,
	bitset*)): Remove __unused__ attribute.
	* include/debug/safe_base.h (_Safe_iterator_base): Make
	_Safe_sequence_base a friend.
	(_Safe_iterator_base::_M_attach): Make protected.
	(_Safe_iterator_base::_M_attach_single): Likewise.
	(_Safe_iterator_base::_M_detach): Likewise.
	(_Safe_iterator_base::_M_detach_single): Likewise.
	(_Safe_sequence_base): Make _Safe_iterator_base a friend.
	(_Safe_sequence_base::_Safe_sequence_base(_Safe_sequence_base&&)): New.
	(_Safe_sequence_base::_M_swap): Make protected.
	(_Safe_sequence_base::_M_attach): Make private.
	(_Safe_sequence_base::_M_attach_single): Likewise.
	(_Safe_sequence_base::_M_detach): Likewise.
	(_Safe_sequence_base::_M_detach_single): Likewise.
	* include/debug/safe_container.h
	(_Safe_container::_Safe_container(_Safe_container&&)): Make default.
	* include/debug/safe_iterator.h
	(_Safe_iterator::operator++()): Name __scoped_lock instance.
	* include/debug/safe_iterator.tcc: Remove trailing line.
	* include/debug/safe_unordered_base.h
	(_Safe_local_iterator_base::_M_attach): Make protected.
	(_Safe_local_iterator_base::_M_attach_single): Likewise.
	(_Safe_local_iterator_base::_M_detach): Likewise.
	(_Safe_local_iterator_base::_M_detach_single): Likewise.
	(_Safe_unordered_container_base): Make _Safe_local_iterator_base friend.
	(_Safe_unordered_container_base::_M_attach_local): Make private.
	(_Safe_unordered_container_base::_M_attach_local_single): Likewise.
	(_Safe_unordered_container_base::_M_detach_local): Likewise.
	(_Safe_unordered_container_base::_M_detach_local_single): Likewise.

From-SVN: r240478
2016-09-25 20:15:21 +00:00
François Dumont
edc69abbe1 algo.h: Generalize usage of std::__iterator_category.
2016-09-25  François Dumont  <fdumont@gcc.gnu.org>

	* include/parallel/algo.h: Generalize usage of std::__iterator_category.
	Adjust whitespaces.

From-SVN: r240473
2016-09-25 15:23:45 +00:00
Jonathan Wakely
1319041924 Avoid reallocation for basic_string::clear()
PR libstdc++/56166
	PR libstdc++/77582
	* include/bits/basic_string.h (basic_string::clear()): Drop reference
	and use empty rep.
	* include/ext/rc_string_base.h (__rc_string_base::_M_clear()):
	Likewise.
	* testsuite/21_strings/basic_string/56166.cc: New.
	* testsuite/ext/vstring/modifiers/clear/56166.cc: New.

From-SVN: r240447
2016-09-23 18:25:34 +01:00
Jonathan Wakely
a922c5ff6f Optimize truncating a basic_string
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::erase(size_type, size_type)): Add fast path for
	truncating the string, by calling _M_set_length directly.
	(basic_string::erase(__const_iterator, __const_iterator)): Likewise.
	* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::resize(size_type, _CharT)): Likewise.

From-SVN: r240446
2016-09-23 18:25:23 +01:00
Jason Merrill
7be8d66369 * configure.ac: Define HAVE_MEMALIGN for newlib.
From-SVN: r240435
2016-09-23 10:34:51 -04:00
Sebastian Huber
320c7be3ff [RTEMS] Always use atomic builtins for libstdc++
libstdc++-v3/
	* config/cpu/m68k/atomicity.h: Adjust comment.
	* acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Honor
	explicit atomicity_dir setup via configure.host.
	* configure.host (rtems-*): Set atomicity_dir.
	* configure: Regenerate.

From-SVN: r240387
2016-09-23 06:58:00 +00:00
Jonathan Wakely
2dbe56bdfb Implement C++17 node extraction and insertion (P0083R5)
* doc/xml/manual/status_cxx2017.xml: Document status.
	* doc/html/*: Regenerate.
	* include/Makefile.am: Add bits/node_handle.h and reorder.
	* include/Makefile.in: Regenerate.
	* include/bits/hashtable.h (_Hashtable::node_type)
	(_Hashtable::insert_return_type, _Hashtable::_M_reinsert_node)
	(_Hashtable::_M_reinsert_node_multi, _Hashtable::extract)
	(_Hashtable::_M_merge_unique, _Hashtable::_M_merge_multi): Define.
	(_Hash_merge_helper): Define primary template.
	* include/bits/node_handle.h: New header.
	* include/bits/stl_map.h (map): Declare _Rb_tree_merge_helper as
	friend.
	(map::node_type, map::insert_return_type, map::extract, map::merge)
	(map::insert(node_type&&), map::insert(const_iterator, node_type&&)):
	Define new members.
	(_Rb_tree_merge_helper): Specialize for map.
	* include/bits/stl_multimap.h (multimap): Declare _Rb_tree_merge_helper
	as friend.
	(multimap::node_type, multimap::extract, multimap::merge)
	(multimap::insert(node_type&&))
	(multimap::insert(const_iterator, node_type&&)): Define.
	(_Rb_tree_merge_helper): Specialize for multimap.
	* include/bits/stl_multiset.h (multiset): Declare _Rb_tree_merge_helper
	as friend.
	(multiset::node_type, multiset::extract, multiset::merge)
	(multiset::insert(node_type&&))
	(multiset::insert(const_iterator, node_type&&)): Define.
	* include/bits/stl_set.h (set): Declare _Rb_tree_merge_helper as
	friend.
	(set::node_type, set::insert_return_type, set::extract, set::merge)
	(set::insert(node_type&&), set::insert(const_iterator, node_type&&)):
	Define.
	(_Rb_tree_merge_helper): Specialize for set.
	* include/bits/stl_tree.h (_Rb_tree): Declare _Rb_tree<> as friend.
	(_Rb_tree::node_type, _Rb_tree::insert_return_type)
	(_Rb_tree::_M_reinsert_node_unique, _Rb_tree::_M_reinsert_node_equal)
	(_Rb_tree::_M_reinsert_node_hint_unique)
	(_Rb_tree::_M_reinsert_node_hint_equal, _Rb_tree::extract)
	(_Rb_tree::_M_merge_unique, _Rb_tree::_M_merge_equal): Define.
	(_Rb_tree_merge_helper): Specialize for multiset.
	* include/bits/unordered_map.h (unordered_map): Declare
	unordered_map<> and unordered_multimap<> as friends.
	(unordered_map::node_type, unordered_map::insert_return_type)
	(unordered_map::extract, unordered_map::merge)
	(unordered_map::insert(node_type&&))
	(unordered_map::insert(const_iterator, node_type&&))
	(unordered_multimap): Declare _Hash_merge_helper as friend.
	(unordered_multimap::node_type, unordered_multimap::extract)
	(unordered_multimap::merge, unordered_multimap::insert(node_type&&))
	(unordered_multimap::insert(const_iterator, node_type&&)): Define.
	(_Hash_merge_helper): Specialize for unordered maps and multimaps.
	* include/bits/unordered_set.h (unordered_set, unordered_multiset):
	Declare _Hash_merge_helper as friend.
	(unordered_set::node_type, unordered_set::insert_return_type)
	(unordered_set::extract, unordered_set::merge)
	(unordered_set::insert(node_type&&))
	(unordered_set::insert(const_iterator, node_type&&)): Define.
	(unordered_multiset::node_type, unordered_multiset::extract)
	(unordered_multiset::merge, unordered_multiset::insert(node_type&&))
	(unordered_multiset::insert(const_iterator, node_type&&)): Define.
	(_Hash_merge_helper): Specialize for unordered sets and multisets.
	* include/debug/map.h (map): Add using declarations or forwarding
	functions for new members.
	* include/debug/map.h (multimap): Likewise.
	* include/debug/map.h (multiset): Likewise.
	* include/debug/map.h (set): Likewise.
	* include/debug/unordered_map (unordered_map, unordered_multimap):
	Likewise.
	* include/debug/unordered_set( unordered_set, unordered_multiset):
	Likewise.
	* python/libstdcxx/v6/printers.py (get_value_from_aligned_membuf): New
	helper function.
	(get_value_from_list_node, get_value_from_Rb_tree_node): Use helper.
	(StdNodeHandlePrinter): Define printer for node handles.
	(build_libstdcxx_dictionary): Register StdNodeHandlePrinter.
	* testsuite/23_containers/map/modifiers/extract.cc: New.
	* testsuite/23_containers/map/modifiers/merge.cc: New.
	* testsuite/23_containers/multimap/modifiers/extract.cc: New.
	* testsuite/23_containers/multimap/modifiers/merge.cc: New.
	* testsuite/23_containers/multiset/modifiers/extract.cc: New.
	* testsuite/23_containers/multiset/modifiers/merge.cc: New.
	* testsuite/23_containers/set/modifiers/extract.cc: New.
	* testsuite/23_containers/set/modifiers/merge.cc: New.
	* testsuite/23_containers/unordered_map/modifiers/extract.cc: New.
	* testsuite/23_containers/unordered_map/modifiers/merge.cc: New.
	* testsuite/23_containers/unordered_multimap/modifiers/extract.cc:
	New.
	* testsuite/23_containers/unordered_multimap/modifiers/merge.cc: New.
	* testsuite/23_containers/unordered_multiset/modifiers/extract.cc:
	New.
	* testsuite/23_containers/unordered_multiset/modifiers/merge.cc: New.
	* testsuite/23_containers/unordered_set/modifiers/extract.cc: New.
	* testsuite/23_containers/unordered_set/modifiers/merge.cc: New.
	* testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust
	dg-error lineno.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Test node handles.

From-SVN: r240363
2016-09-22 14:58:49 +01:00
Ville Voutilainen
8a4c4f1273 Fix tests on old arm platforms for optional.
* testsuite/20_util/optional/77288.cc: Don't use exception_ptr.

From-SVN: r240347
2016-09-22 14:01:29 +03:00
Jonathan Wakely
6fdc74c91b Update pretty printer for std::variant
* python/libstdcxx/v6/printers.py (StdVariantPrinter): Adjust for
	recent change to _Variant_storage.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Test variant with
	reference type.

From-SVN: r240345
2016-09-22 11:06:41 +01:00
Jonathan Wakely
64626fcaaa Always qualify std::forward in <variant>
* include/bits/uses_allocator.h (__uses_allocator_construct): Qualify
	std::forward and ::new. Cast pointer to void*.
	* include/std/variant (_Variant_storage, _Union, _Variant_base)
	(__access, __visit_invoke, variant, visit): Qualify std::forward.
	* testsuite/20_util/variant/compile.cc: Test for ADL problems.

From-SVN: r240344
2016-09-22 10:56:54 +01:00
Tim Shen
c42bc5d73b variant (variant::operator=): Fix assignment on references.
* libstdc++-v3/include/std/variant (variant::operator=): Fix assignment
	on references.
	* libstdc++-v3/testsuite/20_util/variant/compile.cc: Add test.

From-SVN: r240343
2016-09-22 08:45:55 +00:00
Tim Shen
41501d1ae7 re PR libstdc++/77641 (std::variant copy-initialization fails for type with non-trivial constexpr ctor)
PR libstdc++/77641
	* include/std/variant (_Variant_storage::_Variant_storage):
	Change _Variant_storage's union to be default constructible.
	* testsuite/20_util/variant/compile.cc: New test.

From-SVN: r240340
2016-09-22 03:15:58 +00:00
Ville Voutilainen
b641f833ba re PR libstdc++/77288 (Std::experimental::optional::operator= implementation is broken in gcc 6.1)
PR libstdc++/77288
	* include/std/optional (__is_optional_impl, __is_optional): Remove.
	(__converts_from_optional, __assigns_from_optional): New.
	(optional(_Up&&)): Use is_same instead of __is_optional.
	(optional(const optional<_Up>&)): Constrain with
	__converts_from_optional.
	(optional(optional<_Up>&&)): Likewise.
	(operator=(_Up&&)): Use is_same instead of __is_optional, check
	is_same and is_scalar.
	(operator=(const optional<_Up>&)): Constrain with
	__converts_from_optional and __assigns_from_optional.
	(operator=(optional<_Up>&&)): Likewise.
	* testsuite/20_util/optional/77288.cc: New.
	* testsuite/20_util/optional/cons/value.cc: Adjust.

From-SVN: r240324
2016-09-21 20:37:17 +03:00
Ville Voutilainen
5578678524 Implement LWG 2729 for tuple.
* include/std/tuple (_Tuple_impl(_Tuple_impl&&)):
	Suppress conditionally.
	(_Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&&)): Likewise.
	(__is_tuple_impl_trait_impl, __is_tuple_impl_trait): New.
	(_Tuple_impl(const _Head&)): Constrain.
	(_Tuple_impl(_UHead&&)): Likewise.
	(_Tuple_impl(_Tuple_impl&&)): Suppress conditionally.
	(_Tuple_impl(const _Tuple_impl<_Idx, _UHead>&)): Constrain.
	(_Tuple_impl(_Tuple_impl<_Idx, _UHead>&&)): Likewise.
	(operator=(const tuple&)): Enable conditionally.
	(operator=(tuple&&)): Suppress conditionally.
	(operator=(const tuple<_UElements...>&)): Constrain.
	(operator=(tuple<_UElements...>&&)): Likewise.
	(operator=(const tuple&)): Enable conditionally (2-param tuple).
	(operator=(tuple&&)): Suppress conditionally (2-param tuple).
	(operator=(const tuple<_U1, _U2>&)): Constrain.
	(operator=(tuple<_U1, _U2>&&)): Likewise.
	(operator=(const pair<_U1, _U2>&)): Likewise.
	(operator=(pair<_U1, _U2>&&)): Likewise.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Adjust.
	* testsuite/20_util/tuple/tuple_traits.cc: New.

From-SVN: r240323
2016-09-21 20:25:16 +03:00
Ville Voutilainen
f524d5b34a re PR libstdc++/77537 (pair constructors do not properly SFINAE)
PR libstdc++/77537
	Implement LWG 2729 for pair.
	* include/bits/stl_pair.h (_PCC): New.
	(_ConstructiblePair, _ImplicitlyConvertiblePair):
	Turn into static member functions of _PCC.
	(_MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): Likewise.
	(_PCCP): New.
	(pair(const _T1&, const _T2&)): Adjust.
	(_PCCFP): New.
	(pair(const pair<_U1, _U2>&)): Adjust.
	(pair(_U1&&, const _T2&)): Likewise.
	(pair(const _T1&, _U2&&)): Likewise.
	(pair(_U1&&, _U2&&)): Likewise.
	(pair(pair<_U1, _U2>&&)): Likewise.
	(operator=(const pair&)): Make conditionally deleted.
	(operator=(pair&&)): Make conditionally suppressed.
	(operator=(const pair<_U1, _U2>&)): Constrain.
	(operator=(pair<_U1, _U2>&&): Likewise.
	* include/std/type_traits (__nonesuch): New.
	* testsuite/20_util/pair/traits.cc: New.

From-SVN: r240322
2016-09-21 19:48:35 +03:00
Ville Voutilainen
377f30c00f re PR libstdc++/77619 (uninitialized_meow_construct and friends not exception safe)
PR libstdc++/77619
	* include/bits/stl_construct.h: (_Construct_novalue): New.
	(_Destroy_n_aux, _Destroy_n): New.
	* include/bits/stl_uninitialized.h: (type_traits):
	New include in C++11 mode.
	(__uninitialized_default_novalue_1): New.
	(__uninitialized_default_novalue_n_1): Likewise.
	(__uninitialized_default_novalue): Likewise.
	(__uninitialized_default_novalue_n): Likewise.
	(__uninitialized_copy_n_pair): Likewise.
	(uninitialized_default_construct):
	Use __uninitialized_default_novalue.
	(uninitialized_default_construct_n):
	Use __uninitialized_default_novalue_n.
	(uninitialized_value_construct): Use __uninitialized_default.
	(uninitialized_value_construct_n): Use __uninitialized_default_n.
	(uninitialized_move): Use uninitialized_copy.
	(uninitialized_move_n): Use __uninitialized_copy_n_pair.
	(destroy_at): Use _Destroy.
	(destroy): Likewise.
	(destroy_n): Likewise.
	* testsuite/20_util/specialized_algorithms/
	memory_management_tools/1.cc: Add tests for exceptions,
	add tests for trivial cases for construct and move.

From-SVN: r240264
2016-09-20 18:15:36 +03:00
Jonathan Wakely
564beb5f9b Replace casts with floordiv operator in Python xmethods
* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__)
	(DequeWorkerBase.index, VectorWorkerBase.get): Use // for division.

From-SVN: r240258
2016-09-20 10:57:02 +01:00
Jonathan Wakely
d0f5943566 libstdc++/77645 fix deque and vector xmethods for Python 3
PR libstdc++/77645
	* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__)
	(DequeWorkerBase.index, VectorWorkerBase.get): Cast results of
	division to int to work with Python 3.

From-SVN: r240241
2016-09-19 18:09:04 +01:00
Jonathan Wakely
ee1ab3e3c2 Make libstdc++ tests FAIL on Python errors
* testsuite/lib/gdb-test.exp (gdb-test): Fail if Python error occurs.

From-SVN: r240237
2016-09-19 16:59:04 +01:00
Jonathan Wakely
a0a1009abf Improve pretty printer for std::variant
* python/libstdcxx/v6/printers.py (SingleObjContainerPrinter): Allow
	display_hint to be set by subclasses.
	(StdVariantPrinter): Use array for display_hint. Adjust output to be
	more similar to std::any and std::optional output.
	(register_type_printers): Add type printers for basic_string_view
	typedefs and experimental::any. Adjust type printers for
	fundamentals_v1 templates to match fundamentals_v2 and later.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: New.

From-SVN: r240234
2016-09-19 16:49:27 +01:00
Jonathan Wakely
019270bcb3 libstdc++/77645 Fix xmethods for std::list
PR libstdc++/77645
	* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index): Rename
	argument.
	(ListWorkerBase.get_value_from_node): Define new method.
	(ListFrontWorker.__call__, ListBackWorker.__call__): Use it.

From-SVN: r240233
2016-09-19 16:49:19 +01:00
Jonathan Wakely
0089537230 Define pretty printers for C++17 library components
* python/libstdcxx/v6/printers.py (StdVariantPrinter): Define.
	(StdExpAnyPrinter, StdExpOptionalPrinter, StdExpStringViewPrinter):
	Register for C++17 components in namespace std. Strip inline namespace
	from typename.

From-SVN: r240215
2016-09-17 16:20:23 +01:00
Jonathan Wakely
6ee3fd9742 Fix typo in Libstdc++ Profile Mode docs
* doc/xml/manual/profile_mode.xml: Fix typo.
	* doc/html/manual/profile_mode_devel.html: Regenerate.

From-SVN: r240204
2016-09-16 23:09:15 +01:00