Commit Graph

7505 Commits

Author SHA1 Message Date
Jonathan Wakely
22620c1452 Remove memory leaks in libstdc++ testsuite
* testsuite/18_support/new_delete_placement.cc: Don't allocate (and
	leak) memory for arguments to placement delete.
	* testsuite/20_util/addressof/1.cc: Don't leak memory.
	* testsuite/22_locale/locale/global_locale_objects/3.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/insert/55028-debug.cc:
	Likewise.

From-SVN: r238607
2016-07-21 20:38:32 +01:00
Jonathan Wakely
09a855ae3c Document LWG DR 2684 status and regenerate libstdc++ manual
* doc/xml/manual/intro.xml: Document DR 2684 status.
	* doc/html/*: Regenerate.

From-SVN: r238535
2016-07-20 19:22:05 +01:00
Jonathan Wakely
e87b7d52c3 LWG 2441 Provide exact-width atomic typedefs
* include/std/atomic (atomic_int8_t, atomic_uint8_t, atomic_int16_t)
	(atomic_uint16_t, atomic_int32_t, atomic_uint32_t, atomic_int64_t)
	(atomic_uint64_t): Define (LWG 2441).
	* testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc: Remove empty
	lines.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Test for
	the new types.
	* doc/xml/manual/intro.xml: Document DR 2441 status.

From-SVN: r238534
2016-07-20 19:21:59 +01:00
Jonathan Wakely
07c772ed4e LWG 2328 Rvalue stream extraction should use perfect forwarding
* include/std/istream (operator>>(basic_istream&&, _Tp&)): Adjust
	to use perfect forwarding (LWG 2328).
	* testsuite/27_io/rvalue_streams.cc: Test perfect forwarding.
	* doc/xml/manual/intro.xml: Document DR 2328 status.

From-SVN: r238533
2016-07-20 19:21:53 +01:00
Jonathan Wakely
18407bfb2c Use static pointer to member when catching nullptr
libstdc++-v3:

	* libsupc++/pbase_type_info.cc (__pbase_type_info::__do_catch): Use
	static objects for catching nullptr as pointer to member types.

gcc/testsuite:

	* g++.dg/cpp0x/nullptr35.C: Change expected result for catching as
	pointer to member function and also test catching by reference.

From-SVN: r238532
2016-07-20 19:21:48 +01:00
Ville Voutilainen
40f3e91334 Clean up optional's comments.
From-SVN: r238436
2016-07-18 17:45:56 +03:00
Jonathan Wakely
4f5f9962c8 Replace references to C++0x with C++11 in comments
* include/bits/algorithmfwd.h: Change C++0x to C++11 in comments.
	* include/bits/move.h: Likewise.
	* include/bits/postypes.h: Likewise.
	* include/debug/bitset: Likewise.
	* include/ext/pb_ds/detail/type_utils.hpp: Likewise.
	* include/ext/string_conversions.h: Change C++0x to __cxx11 in
	comment.
	* testsuite/27_io/fpos/14320-1.cc: Change C++0x to C++11 in comment.
	* testsuite/util/thread/all.h: Likewise.

From-SVN: r238402
2016-07-15 21:23:08 +01:00
Jonathan Wakely
d1129d45b0 Remove redundant std::move in std::for_each
* include/bits/stl_algo.h (for_each): Remove redundant _GLIBCXX_MOVE
	and adjust comment.

From-SVN: r238399
2016-07-15 20:51:33 +01:00
Jonathan Wakely
479d0ed590 c++/58796 Make nullptr match exception handlers of pointer type
libstdc++-v3:

	PR c++/58796
	* libsupc++/pbase_type_info.cc (__pbase_type_info::__do_catch): Make
	nullptr match handlers of pointer type.

gcc/testsuite:

	PR c++/58796
	* g++.dg/cpp0x/nullptr21.C: Remove void* handlers.
	* g++.dg/cpp0x/nullptr35.C: New test.

From-SVN: r238396
2016-07-15 19:51:51 +01:00
Edward Smith-Rowland
4db1cb44be Implement C++17 P0025 clamp.
2016-07-15  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement C++17 P0025 clamp.
	* include/bits/algorithmfwd.h: Declare clamp overloads.
	* include/bits/stl_algo.h: Implement clamp.  Feature __cpp_lib_clamp.
	* testsuite/25_algorithms/clamp/1.cc: New test.
	* testsuite/25_algorithms/clamp/2.cc: New test.
	* testsuite/25_algorithms/clamp/constexpr.cc: New test.
	* testsuite/25_algorithms/clamp/requirements/explicit_instantiation/
	1.cc: New test.
	* testsuite/25_algorithms/clamp/requirements/explicit_instantiation/
	pod.cc: New test.

From-SVN: r238383
2016-07-15 17:16:32 +00:00
Ville Voutilainen
1ec0f76305 Fix the constraints for any's assignment operator template to properly
reject assignment from a non-copyable lvalue.

From-SVN: r238365
2016-07-15 10:44:22 +03:00
Jonathan Wakely
ea5ec6b7e0 Include header for std::__parallel::search
* include/experimental/functional: Include <parallel/algorithm> in
	Parallel Mode.

From-SVN: r238342
2016-07-14 16:43:17 +01:00
Jonathan Wakely
47d5cb3c3b Add header for std::search to testcase
* testsuite/experimental/functional/searchers.cc: Include <algorithm>
	for std::search.

From-SVN: r238341
2016-07-14 16:27:09 +01:00
Jonathan Wakely
0a2bf18874 Improve doxygen comments for allocators in containers
PR libstdc++/70716
	* include/bits/forward_list.h (forward_list): Update doxygen comments
	to reflect allocator propagation semantics. Remove ambiguous
	statements about data being lost.
	* include/bits/stl_deque.h (deque): Likewise.
	* include/bits/stl_list.h (list): Likewise.
	* 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_vector.h (vector): Likewise.
	* include/bits/unordered_map.h (unordered_map, unordered_multimap):
	Likewise.
	* include/bits/unordered_set.h (unordered_set, unordered_multiset):
	Likewise.

From-SVN: r238332
2016-07-14 11:02:10 +01:00
Ville Voutilainen
25a69162c9 Implement P0032R3, Homogeneous interface for variant, any and optional,
for the parts concerning any and optional.
	* include/std/any (_Storage()): Make constexpr and have it
	initialize _M_ptr.
	(any()): Make constexpr.
	(any(const any&)): Adjust.
	(any(any&&)): Likewise.
	(__any_constructible_t): New.
	(any(_ValueType&&)): Constrain.
	(any(in_place_type_t<_Tp>, _Args&&...)): New.
	(any(in_place_type_t<_Tp>, initializer_list<_Up>, _Args&&...)):
	Likewise.
	(~any()): Adjust.
	(operator=(const any&)): Likewise.
	(operator=(any&&)): Likewise.
	(operator=(_ValueType&&)): Constrain.
	(emplace(_Args&&...)): New.
	(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
	(clear()): Remove.
	(reset()): New.
	(swap(any&)): Adjust.
	(empty()): Remove.
	(has_value()): New.
	(type()): Adjust.
	(_Manager_internal::_S_create(_Storage&, _Args&&...)): New.
	(_Manager_external::_S_create(_Storage&, _Args&&...)): Likewise.
	(make_any(_Args&&...)): Likewise.
	(make_any(initializer_list<_Up>, _Args&&...)): Likewise.
	* include/std/optional (in_place_t, in_place): Remove.
	(bad_optional_access): Add a comment referring to LEWG 72.
	(emplace(_Args&&...)): Constrain.
	(has_value()): New.
	(reset()): Likewise.
	(make_optional(_Args&&...)): Likewise.
	(make_optional(initializer_list<_Up>, _Args&&...)): Likewise.
	* include/std/utility (in_place_tag): New.
	(__in_place, __in_place_type, __in_place_index): Likewise.
	(in_place_t, in_place_type_t, in_place_index_t): Likewise.
	(in_place(__in_place*)): Likewise.
	(in_place(__in_place_type<_Tp>*)): Likewise.
	(in_place(__in_place_index<_Idx>*)): Likewise.
	* testsuite/20_util/any/assign/1.cc: Adjust.
	* testsuite/20_util/any/assign/emplace.cc: New.
	* testsuite/20_util/any/assign/self.cc: Adjust.
	* testsuite/20_util/any/cons/1.cc: Likewise.
	* testsuite/20_util/any/cons/in_place.cc: New.
	* testsuite/20_util/any/make_any.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast_neg.cc: Adjust.
	* testsuite/20_util/any/misc/swap.cc: Likewise.
	* testsuite/20_util/any/modifiers/1.cc: Likewise.
	* testsuite/20_util/any/requirements.cc: New.
	* testsuite/20_util/in_place/requirements.cc: Likewise.
	* testsuite/20_util/optional/constexpr/in_place.cc: Adjust.
	* testsuite/20_util/optional/in_place.cc: Likewise.
	* testsuite/20_util/optional/make_optional.cc: Add tests for
	the new overloads of make_optional.

From-SVN: r238329
2016-07-14 12:10:05 +03:00
Ville Voutilainen
c0d31471ba Fix ChangeLog.
From-SVN: r238328
2016-07-14 12:09:50 +03:00
Jonathan Wakely
e383deac8b libstdc++/71856 Define _GLIBCXX_PARALLEL_ASSERTIONS
PR libstdc++/71856
	* include/bits/c++config (_GLIBCXX_ASSERTIONS): Define to 1 not empty.
	* include/parallel/compiletime_settings.h (_GLIBCXX_ASSERTIONS):
	Rename to _GLIBCXX_PARALLEL_ASSERTIONS and make default value depend
	on _GLIBCXX_ASSERTIONS.
	* include/parallel/balanced_quicksort.h: Rename _GLIBCXX_ASSERTIONS.
	Include <unistd.h> for sleep.
	* include/parallel/losertree.h: Rename _GLIBCXX_ASSERTIONS.
	* include/parallel/merge.h: Likewise.
	* include/parallel/multiway_merge.h: Likewise.
	* include/parallel/partition.h: Likewise.
	* include/parallel/queue.h: Likewise.
	* include/parallel/sort.h: Likewise.
	* testsuite/25_algorithms/headers/algorithm/
	parallel_algorithm_assert.cc: New.

From-SVN: r238307
2016-07-13 18:22:57 +01:00
Jonathan Wakely
17f8dc9367 Make basic_string::replace forward to different overload
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(replace(__const_iterator, __const_iterator, initializer_list<C>)):
	Forward to different overload.

From-SVN: r238306
2016-07-13 18:22:51 +01:00
Jonathan Wakely
260d92cd0d Make __allocated_ptr::_S_raw_ptr static
* include/bits/allocated_ptr.h (__allocated_ptr::_S_raw_ptr): Make
	static.

From-SVN: r238305
2016-07-13 18:22:47 +01:00
Jonathan Wakely
2d60da1031 Revert "Add non-const overload of std::string::data()"
This reverts r238291 aka 4300aa2087d90cd2d55852fa38f082a89bc7e72d.

From-SVN: r238303
2016-07-13 16:56:46 +01:00
Ville Voutilainen
05505e9d69 Fix ChangeLog.
From-SVN: r238293
2016-07-13 14:27:37 +03:00
Ville Voutilainen
86c0ec1de1 Implement P0307R2, Making Optional Greater Equal Again.
* include/experimental/optional (_Has_addressof): Fix the comment.
	* include/std/optional (_Has_addressof): Likewise.
	(operator=(_Up&&)): Constrain.
	(operator=(const optional<_Up>&)): Likewise.
	(operator=(optional<_Up>&&)): Likewise.
	(__optional_relop_t): New.
	(operator==(const optional<_Tp>&, const optional<_Tp>&)): Constrain.
	(operator!=(const optional<_Tp>&, const optional<_Tp>&)):
	Constrain and make transparent.
	(operator<(const optional<_Tp>&, const optional<_Tp>&)): Constrain.
	(operator>(const optional<_Tp>&, const optional<_Tp>&)):
	Constrain and make transparent.
	(operator<=(const optional<_Tp>&, const optional<_Tp>&)): Likewise.
	(operator>=(const optional<_Tp>&, const optional<_Tp>&)): Likewise.
	(operator==(const optional<_Tp>&, const _Tp&): Constrain.
	(operator==(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator!=(const optional<_Tp>&, _Tp const&)):
	Constrain and make transparent.
	(operator!=(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator<(const optional<_Tp>&, const _Tp&)): Constrain.
	(operator<(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator>(const optional<_Tp>&, const _Tp&)):
	Constrain and make transparent.
	(operator>(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator<=(const optional<_Tp>&, const _Tp&)): Likewise.
	(operator<=(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator>=(const optional<_Tp>&, const _Tp&)): Likewise.
	(operator>=(const _Tp&, const optional<_Tp>&)): Likewise.
	* testsuite/20_util/optional/constexpr/relops/2.cc: Adjust.
	* testsuite/20_util/optional/constexpr/relops/4.cc: Likewise.
	* testsuite/20_util/optional/relops/1.cc: Likewise.
	* testsuite/20_util/optional/relops/2.cc: Likewise.
	* testsuite/20_util/optional/relops/3.cc: Likewise.
	* testsuite/20_util/optional/relops/4.cc: Likewise.
	* testsuite/20_util/optional/requirements.cc: Add tests to verify
	that optional's relops are transparent and don't synthesize
	operators. Also test that assignment sfinaes.

From-SVN: r238292
2016-07-13 14:25:51 +03:00
Jonathan Wakely
ceea48fc64 Add non-const overload of std::string::data()
Also fix confusion between pointer and _CharT*, so that allocators with
fancy pointers work correctly.

	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] (_M_c_str):
	New function.
	(_M_disjunct, basic_string(const basic_string&, size_t)): Use data()
	instead of _M_data().
	(basic_string(const basic_string&, size_t, size_t, const _Alloc&)):
	Likewise.
	(append(const basic_string&)): Likewise.
	(append(const basic_string&, size_type, size_type)): Likewise.
	(assign(const basic_string&, size_type, size_type)): Likewise.
	(insert(size_type, const basic_string&)): Likewise.
	(insert(size_type, const basic_string&, size_type, size_type)):
	Likewise.
	(replace(size_type, size_type, const basic_string&, size_type,
	size_type)): Likewise.
	(replace(__const_iterator, __const_iterator, const basic_string&)):
	Likewise.
	(c_str(), data()): Use c_str() instead of _M_data().
	(data()): Add non-const overload as per LWG 2391 and P0272R1.
	(compare(const basic_string&)): Use data() instead of _M_data().
	[!_GLIBCXX_USE_CXX11_ABI] (data()): Add non-const overload.
	* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI] (_M_mutate):
	Pass raw pointers to _S_copy.
	(_M_erase, _M_replace_aux): Pass raw pointers to _S_move and
	_S_assign.
	(find(const _CharT*, size_type, size_type)): Use data instead of
	_M_data().
	* testsuite/21_strings/basic_string/allocator/char/ext_ptr.cc: New.
	* testsuite/21_strings/basic_string/operations/data/char/2.cc: New.
	* testsuite/21_strings/basic_string/operations/data/wchar_t/2.cc: New.

From-SVN: r238291
2016-07-13 12:08:37 +01:00
Jonathan Wakely
7cbadfdced Remove unused operator delete overloads (LWG 2458)
* libsupc++/new: Remove nothrow sized deletes (LWG 2458).
	* doc/xml/manual/intro.xml: Document DR 2458 status.
	* doc/html*: Regenerate.

From-SVN: r238246
2016-07-12 15:31:04 +01:00
Jonathan Wakely
1b1c16e0c0 Fix ChangeLog entry for r238244
From-SVN: r238245
2016-07-12 15:07:49 +01:00
Jonathan Wakely
1b24fb4cd1 Add tests and docs for LWG 2212 support
* testsuite/20_util/pair/astuple/astuple.cc: Only include <utility>.
	* testsuite/23_containers/array/tuple_interface/tuple_element.cc:
	Only include <array>.
	* testsuite/23_containers/array/tuple_interface/tuple_size.cc:
	Likewise.
	* doc/xml/manual/intro.xml; Document LWG 2212 support.
	* doc/html*: Regenerate.

From-SVN: r238244
2016-07-12 15:00:26 +01:00
Jonathan Wakely
17b31c054c Add std::vector::emplace() testcase from LWG 2164
* testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc:
	Add testcase from LWG 2164.

From-SVN: r238243
2016-07-12 15:00:11 +01:00
François Dumont
76225d2ca7 stl_vector.h (push_back(const value_type&)): Forward to _M_realloc_insert.
2016-07-11  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_vector.h (push_back(const value_type&)): Forward
	to _M_realloc_insert.
	(insert(const_iterator, value_type&&)): Forward to _M_insert_rval.
	(_M_realloc_insert): Declare new function.
	(_M_emplace_back_aux): Remove definition.
	* include/bits/vector.tcc (emplace_back(_Args...)):
	Use _M_realloc_insert.
	(insert(const_iterator, const value_type&)): Likewise.
	(_M_insert_rval, _M_emplace_aux): Likewise.
	(_M_emplace_back_aux): Remove declaration.
	(_M_realloc_insert): Define.
	* testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc:
	Adjust expected results for emplacing an lvalue with reallocation.

From-SVN: r238226
2016-07-11 20:17:56 +00:00
Ville Voutilainen
435e56fb52 Implement std::optional.
* include/Makefile.am: Add optional to exported headers.
	* include/Makefile.in: Likewise.
	* include/std/optional: New.
	* testsuite/20_util/optional/typedefs.cc: Likewise.
	* testsuite/20_util/optional/relops/2.cc: Likewise.
	* testsuite/20_util/optional/relops/3.cc: Likewise.
	* testsuite/20_util/optional/relops/4.cc: Likewise.
	* testsuite/20_util/optional/relops/5.cc: Likewise.
	* testsuite/20_util/optional/relops/1.cc: Likewise.
	* testsuite/20_util/optional/relops/6.cc: Likewise.
	* testsuite/20_util/optional/nullopt.cc: Likewise.
	* testsuite/20_util/optional/in_place.cc: Likewise.
	* testsuite/20_util/optional/make_optional.cc: Likewise.
	* testsuite/20_util/optional/assignment/2.cc: Likewise.
	* testsuite/20_util/optional/assignment/3.cc: Likewise.
	* testsuite/20_util/optional/assignment/4.cc: Likewise.
	* testsuite/20_util/optional/assignment/5.cc: Likewise.
	* testsuite/20_util/optional/assignment/1.cc: Likewise.
	* testsuite/20_util/optional/assignment/6.cc: Likewise.
	* testsuite/20_util/optional/cons/value_neg.cc: Likewise.
	* testsuite/20_util/optional/cons/default.cc: Likewise.
	* testsuite/20_util/optional/cons/move.cc: Likewise.
	* testsuite/20_util/optional/cons/value.cc: Likewise.
	* testsuite/20_util/optional/cons/copy.cc: Likewise.
	* testsuite/20_util/optional/requirements.cc: Likewise.
	* testsuite/20_util/optional/observers/2.cc: Likewise.
	* testsuite/20_util/optional/observers/3.cc: Likewise.
	* testsuite/20_util/optional/observers/4.cc: Likewise.
	* testsuite/20_util/optional/observers/5.cc: Likewise.
	* testsuite/20_util/optional/observers/1.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/2.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/3.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/4.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/5.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/1.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/6.cc: Likewise.
	* testsuite/20_util/optional/constexpr/nullopt.cc: Likewise.
	* testsuite/20_util/optional/constexpr/in_place.cc: Likewise.
	* testsuite/20_util/optional/constexpr/make_optional.cc: Likewise.
	* testsuite/20_util/optional/constexpr/cons/default.cc: Likewise.
	* testsuite/20_util/optional/constexpr/cons/value.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/2.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/3.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/4.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/5.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/1.cc: Likewise.
	* testsuite/20_util/optional/swap/1.cc: Likewise.

From-SVN: r238197
2016-07-10 20:44:21 +03:00
Jonathan Wakely
d81102f473 * testsuite/23_containers/vector/modifiers/insert/aliasing.cc: New.
From-SVN: r238169
2016-07-08 17:35:10 +01:00
Jonathan Wakely
9fc0faf012 Update libstdc++ status docs
* doc/xml/manual/status_cxx2014.xml: Update LFTS status table.
	* doc/html/*: Regenerate.

From-SVN: r238120
2016-07-07 17:35:43 +01:00
Ville Voutilainen
52e8622199 Implement std::any.
* include/Makefile.am: Add any and c++17_warning.h to exported headers.
	* include/Makefile.in: Likewise.
	* include/std/any: New.
	* testsuite/20_util/any/assign/1.cc: Likewise.
	* testsuite/20_util/any/assign/2.cc: Likewise.
	* testsuite/20_util/any/assign/self.cc: Likewise.
	* testsuite/20_util/any/cons/1.cc: Likewise.
	* testsuite/20_util/any/cons/2.cc: Likewise.
	* testsuite/20_util/any/cons/aligned.cc: Likewise.
	* testsuite/20_util/any/cons/nontrivial.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast_neg.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast_no_rtti.cc: Likewise.
	* testsuite/20_util/any/misc/swap.cc: Likewise.
	* testsuite/20_util/any/modifiers/1.cc: Likewise.
	* testsuite/20_util/any/observers/type.cc: Likewise.
	* testsuite/20_util/any/typedefs.cc: Likewise.

From-SVN: r238061
2016-07-07 01:33:20 +03:00
Ville Voutilainen
3042e70851 Add a new header for diagnosing the use of C++17 facilities in pre-C++17 modes.
From-SVN: r238058
2016-07-06 21:07:57 +03:00
Ville Voutilainen
6ffe854859 Implement LWG 2451, optional<T> should 'forward' T's implicit conversions.
Implement LWG 2451, optional<T> should 'forward' T's
	implicit conversions.
	* include/experimental/optional (__is_optional_impl, __is_optional):
	New.
	(optional()): Make constexpr and default.
	(optional(_Up&&), optional(const optional<_Up>&),
	optional(optional<_Up>&& __t): New.
	(operator=(_Up&&)): Constrain.
	(operator=(const optional<_Up>&), operator=(optional<_Up>&&)): New.
	* testsuite/experimental/optional/cons/value.cc:
	Add tests for the functionality added by LWG 2451.
	* testsuite/experimental/optional/cons/value_neg.cc: New.

From-SVN: r238049
2016-07-06 16:26:10 +03:00
Ville Voutilainen
7d4f48b5b8 Implement LWG 2509,
any_cast doesn't work with rvalue reference targets and cannot
	move with a value target.
	* include/experimental/any (any(_ValueType&&)): Constrain and
	add an overload that doesn't forward.
	(any_cast(any&&)): Constrain and add an overload that moves.
	* testsuite/experimental/any/misc/any_cast.cc: Add tests for
	the functionality added by LWG 2509.

From-SVN: r238022
2016-07-05 21:33:18 +03:00
François Dumont
097e899495 Add tests for inserting aliased objects into std::vector
2016-07-04  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc:
	New test.
	* testsuite/23_containers/vector/modifiers/insert/self_insert.cc: New
	test.

From-SVN: r237986
2016-07-04 15:52:54 +01:00
Jonathan Wakely
9958c7eb58 Fix std::vector's use of temporary objects
* include/bits/stl_vector.h (emplace(const_iterator, _Args&&...)):
	Define inline. Forward to _M_emplace_aux.
	(insert(const_iterator, value_type&&)): Forward to _M_insert_rval.
	(_M_insert_rval, _M_emplace_aux): Declare new functions.
	(_Temporary_value): New RAII type using allocator to construct/destroy.
	(_S_insert_aux_assign): Remove.
	(_M_insert_aux): Make non-variadic.
	* include/bits/vector.tcc (insert(const_iterator, const value_type&)):
	Use _Temporary_value.
	(emplace(const_iterator, _Args&&...)): Remove definition.
	(_M_insert_rval, _M_emplace_aux): Define.
	(_M_insert_aux): Make non-variadic, stop using _S_insert_aux_assign.
	(_M_fill_insert): Use _Temporary_value.
	* testsuite/23_containers/vector/allocator/construction.cc: New test.
	* testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc:
	Adjust expected results for emplacing an lvalue with reallocation.
	* testsuite/23_containers/vector/check_construct_destroy.cc: Adjust
	expected results to account for construction/destruction of temporary
	using allocator.

From-SVN: r237985
2016-07-04 15:52:46 +01:00
Ville Voutilainen
e12880f96f re PR libstdc++/71313 ([Filesystem TS] remove_all fails to remove directory contents recursively)
PR libstdc++/71313
	* src/filesystem/ops.cc (remove_all(const path&, error_code&)):
	Call remove_all for children of a directory.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	Adjust.

From-SVN: r237978
2016-07-04 15:52:49 +03:00
François Dumont
6c539f2e67 get_debug_neg.cc: Adjust dg-error line numbers.
2016-07-02  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adjust
	dg-error line numbers.
	* testsuite/23_containers/array/tuple_interface/
	tuple_element_debug_neg.cc: Likewise.
	* testsuite/25_algorithms/lexicographical_compare/debug/
	irreflexive_neg.cc: Remove.

From-SVN: r237945
2016-07-02 14:55:20 +00:00
Thomas Preud'homme
72fb6bae83 65913.cc: Require atomic-builtins rather than specific target.
2016-06-30  Thomas Preud'homme  <thomas.preudhomme@arm.com>

libstdc++-v3/
    * testsuite/29_atomics/atomic/65913.cc: Require atomic-builtins rather
    than specific target.

From-SVN: r237879
2016-06-30 14:17:47 +00:00
François Dumont
dc448fa03b re PR libstdc++/71640 (include/c++/7.0.0/bits/hashtable.h:293:7: error: too many template parameters in template redeclaration)
2016-06-27  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/71640
	* include/bits/hashtable.h: Remove _Unique_keya parameter in _Insert
	friend declaration.

From-SVN: r237803
2016-06-27 20:41:59 +00:00
François Dumont
e615c24c30 array (array<>::swap): Fix noexcept qualificaton for zero-size array.
2016-06-23  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/array (array<>::swap): Fix noexcept qualificaton for
	zero-size array.

From-SVN: r237747
2016-06-23 20:21:47 +00:00
Trevor Saunders
0609abdad8 remove mep-* support
libgcc/ChangeLog:

2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* config.host: Remove support for mep-*.
	* config/mep/lib1funcs.S: Remove.
	* config/mep/lib2funcs.c: Remove.
	* config/mep/t-mep: Remove.
	* config/mep/tramp.c: Remove.

gcc/ChangeLog:

2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* common/config/mep/mep-common.c: Remove.
	* config.gcc: Remove mep-* support.
	* config/mep/constraints.md: Remove.
	* config/mep/default.h: Remove.
	* config/mep/intrinsics.h: Remove.
	* config/mep/intrinsics.md: Remove.
	* config/mep/ivc2-template.h: Remove.
	* config/mep/mep-c5.cpu: Remove.
	* config/mep/mep-core.cpu: Remove.
	* config/mep/mep-default.cpu: Remove.
	* config/mep/mep-ext-cop.cpu: Remove.
	* config/mep/mep-intrin.h: Remove.
	* config/mep/mep-ivc2.cpu: Remove.
	* config/mep/mep-pragma.c: Remove.
	* config/mep/mep-protos.h: Remove.
	* config/mep/mep.c: Remove.
	* config/mep/mep.cpu: Remove.
	* config/mep/mep.h: Remove.
	* config/mep/mep.md: Remove.
	* config/mep/mep.opt: Remove.
	* config/mep/predicates.md: Remove.
	* config/mep/t-mep: Remove.
	* doc/install.texi: Remove mep-* documentation.
	* doc/md.texi: Likewise.

gcc/testsuite/ChangeLog:

2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* gcc.dg/tree-ssa/forwprop-28.c: Remove mep-* support.
	* gcc.dg/tree-ssa/reassoc-32.c: Likewise.
	* gcc.dg/tree-ssa/reassoc-33.c: Likewise.
	* gcc.dg/tree-ssa/reassoc-34.c: Likewise.
	* gcc.dg/tree-ssa/reassoc-35.c: Likewise.
	* gcc.dg/tree-ssa/reassoc-36.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c: Likewise.
	* gcc.dg/tree-ssa/ssa-thread-11.c: Likewise.
	* gcc.dg/tree-ssa/vrp87.c: Likewise.
	* lib/target-supports.exp: Likewise.

contrib/ChangeLog:

2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* config-list.mk: Stop testing mep-elf.

libstdc++-v3/ChangeLog:

2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* configure.host: Remove mep-* support.

From-SVN: r237666
2016-06-21 21:57:49 +00:00
Trevor Saunders
8466af0668 remove knetbsd support
gcc/ChangeLog:

2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* config.gcc: Remove support for knetbsd.
	* configure.ac: Likewise.
	* config/i386/knetbsd-gnu.h: Remove.  * config/i386/knetbsd-gnu64.h: Remove.
	* config/knetbsd-gnu.h: Remove.
	* configure: Regenerate.

libgcc/ChangeLog:

2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* config.host: Remove support for knetbsd.

libstdc++-v3/ChangeLog:

2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* configure: Regenerate.
	* configure.host: Remove support for knetbsd.
	* crossconfig.m4: Likewise.

contrib/ChangeLog:

2016-06-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* config-list.mk: stop testing knetbsd.

From-SVN: r237662
2016-06-21 21:57:30 +00:00
François Dumont
29dbb034cb re PR libstdc++/71181 (Reserving in unordered_map doesn't reserve enough)
2016-06-20  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/71181
	* include/tr1/hashtable_policy.h
	(_Prime_rehash_policy::_M_next_bkt): Make past-the-end iterator
	dereferenceable to avoid check on lower_bound result.
	(_Prime_rehash_policy::_M_bkt_for_elements): Call latter.
	(_Prime_rehash_policy::_M_need_rehash): Likewise.
	* src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt):
	Always return a value greater than input value. Set _M_next_resize to
	max value when reaching highest prime number.
	* src/shared/hashtable-aux.cc (__prime_list): Add comment about sentinel
	being now useless.
	* testsuite/23_containers/unordered_set/hash_policy/71181.cc: New.
	* testsuite/23_containers/unordered_set/hash_policy/power2_rehash.cc
	(test02): New.
	* testsuite/23_containers/unordered_set/hash_policy/prime_rehash.cc: New.
	* testsuite/23_containers/unordered_set/hash_policy/rehash.cc:
	Fix indentation.

From-SVN: r237617
2016-06-20 20:04:25 +00:00
Jonathan Wakely
3ebacabd0e libstdc++/71545 fix debug checks in binary search algorithms
PR libstdc++/71545
	* include/bits/stl_algobase.h (lower_bound, lexicographical_compare):
	Remove irreflexive checks.
	* include/bits/stl_algo.h (lower_bound, upper_bound, equal_range,
	binary_search): Likewise.
	* testsuite/25_algorithms/equal_range/partitioned.cc: New test.
	* testsuite/25_algorithms/lexicographical_compare/71545.cc: New test.
	* testsuite/25_algorithms/lower_bound/partitioned.cc: New test.
	* testsuite/25_algorithms/upper_bound/partitioned.cc: New test.
	* testsuite/util/testsuite_iterators.h (__gnu_test::test_container):
	Add constructor from array.

From-SVN: r237560
2016-06-17 19:28:34 +01:00
François Dumont
bd2ee798d5 2016-06-16 François Dumont <fdumont@gcc.gnu.org>
* include/debug/debug.h
	(__glibcxx_requires_non_empty_range, __glibcxx_requires_nonempty)
	(__glibcxx_requires_subscript): Move...
	* include/debug/assertions.h: ...here and add __builtin_expect.
	(_GLIBCXX_DEBUG_ONLY): Remove ; value.
	* include/bits/stl_deque.h
	(std::deque<>::operator[]): Add __glibcxx_requires_subscript check.
	(std::deque<>::front()): Add __glibcxx_requires_nonempty check.
	(std::deque<>::back()): Likewise.
	(std::deque<>::pop_front()): Likewise.
	(std::deque<>::pop_back()): Likewise.
	(std::deque<>::swap(deque&)): Add allocator check.
	* include/bits/stl_vector.h
	(std::vector<>::operator[]): Add __glibcxx_requires_subscript check.
	(std::vector<>::front()): Add __glibcxx_requires_nonempty check.
	(std::vector<>::back()): Likewise.
	(std::vector<>::pop_back()): Likewise.
	(std::vector<>::swap(vector&)): Add allocator check.

From-SVN: r237541
2016-06-16 20:34:08 +00:00
Daniel Kruegler
6b9539e2aa Provide swappable traits (p0185r1)
2016-06-16  Daniel Kruegler  <daniel.kruegler@gmail.com>

	Provide swappable traits (p0185r1)
	* include/std/type_traits (is_swappable, is_nothrow_swappable,
	is_swappable_with, is_nothrow_swappable_with, is_swappable_v,
	is_nothrow_swappable_v, is_swappable_with_v,
	is_nothrow_swappable_with_v): New.
	* include/bits/stl_pair.h: Use it as per p0185r1.
	* include/bits/stl_queue.h: Likewise.
	* include/bits/stl_stack.h: Likewise.
	* include/bits/unique_ptr.h: Likewise.
	* include/std/tuple: Likewise.
	* include/std/array: Likewise. Fix zero-size member swap.
	* include/bits/hashtable.h: Use __and_.
	* testsuite/20_util/is_nothrow_swappable/requirements/
	explicit_instantiation.cc: Change test options to std=gnu++17.
	* testsuite/20_util/is_nothrow_swappable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable/value.cc: Likewise.
	* testsuite/20_util/is_swappable/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_swappable/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_swappable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_swappable/requirements/
	explicit_instantiation_ext.cc: New.
	* testsuite/20_util/is_nothrow_swappable/requirements/typedefs_ext.cc:
	New.
	* testsuite/20_util/is_nothrow_swappable/value.h: New.
	* testsuite/20_util/is_nothrow_swappable/value_ext.cc: New.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/
	explicit_instantiation.cc: New.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/typedefs.cc:
	New.
	* testsuite/20_util/is_nothrow_swappable_with/value.cc: New.
	* testsuite/20_util/is_swappable/requirements/
	explicit_instantiation_ext.cc: New.
	* testsuite/20_util/is_swappable/requirements/typedefs_ext.cc: New.
	* testsuite/20_util/is_swappable/value.h: New.
	* testsuite/20_util/is_swappable/value_ext.cc: New.
	* testsuite/20_util/is_swappable_with/requirements/
	explicit_instantiation.cc: New.
	* testsuite/20_util/is_swappable_with/requirements/typedefs.cc: New.
	* testsuite/20_util/is_swappable_with/value.cc: New.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust
	dg-error line numbers.
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
	Likewise.

From-SVN: r237531
2016-06-16 16:07:19 +01:00
Jonathan Wakely
33ac58d529 Remove trailing whitespace from libstdc++ headers
* include/std/array: Remove trailing whitespace.
	* include/std/atomic: Likewise.
	* include/std/bitset: Likewise.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/std/condition_variable: Likewise.
	* include/std/fstream: Likewise.
	* include/std/functional: Likewise.
	* include/std/future: Likewise.
	* include/std/iomanip: Likewise.
	* include/std/iosfwd: Likewise.
	* include/std/istream: Likewise.
	* include/std/limits: Likewise.
	* include/std/ratio: Likewise.
	* include/std/scoped_allocator: Likewise.
	* include/std/sstream: Likewise.
	* include/std/stdexcept: Likewise.
	* include/std/string: Likewise.
	* include/std/system_error: Likewise.
	* include/std/thread: Likewise.
	* include/std/tuple: Likewise.
	* include/std/type_traits: Likewise.
	* include/std/utility: Likewise.
	* include/std/valarray: Likewise.
	* include/std/vector: Likewise.

From-SVN: r237528
2016-06-16 14:47:35 +01:00
Jonathan Wakely
0ae207e947 Optimize inserting value_type into std::vector
* include/bits/stl_vector.h (vector::_S_insert_aux_assign): Define
	new overloaded functions.
	* include/bits/vector.tcc (vector::_M_insert_aux): Use new functions
	to avoid creating a redundant temporary.
	* testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc: New
	test.

From-SVN: r237526
2016-06-16 13:42:21 +01:00