Commit Graph

9186 Commits

Author SHA1 Message Date
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
François Dumont
d7e16fc536 2016-06-15 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_deque.h
	(std::deque<>::operator=): Call _M_assign_aux.
	(std::deque<>::assign(initializer_list<>)): Likewise.
	(std::deque<>::resize(size_t, const value_type&)): Call _M_fill_insert.
	(std::deque<>::insert(const_iterator, initializer_list<>)):
	Call _M_range_insert_aux.
	(std::deque<>::_M_assign_aux<It>(It, It, std::forward_iterator_tag):
	Likewise.
	(std::deque<>::_M_fill_assign): Call _M_fill_insert.
	(std::deque<>::_M_move_assign2): Call _M_assign_aux.
	* include/bits/deque.tcc
	(std::deque<>::operator=): Call _M_range_insert_aux.
	(std::deque<>::_M_assign_aux<It>(It, It, std::input_iterator_tag)):
	Likewise.
	* include/bits/stl_vector.h
	(std::vector<>::operator=): Call _M_assign_aux.
	(std::vector<>::assign(initializer_list<>)): Likewise.
	(std::vector<>::resize(size_t, const value_type&)): Call _M_fill_insert.
	(std::vector<>::insert(const_iterator, initializer_list<>)):
	Call _M_range_insert.
	* include/bits/vector.tcc (std::vector<>::_M_assign_aux): Likewise.

From-SVN: r237495
2016-06-15 20:09:56 +00:00
François Dumont
373c00952c tuple (_Head_base<>): Default specialization condition at type declaration.
2016-06-07  François Dumont  <fdumont@gcc.gnu.org>

	* include/std/tuple (_Head_base<>): Default specialization condition at
	type declaration.

From-SVN: r237184
2016-06-07 20:19:19 +00:00
Ville Voutilainen
dbc6221fe5 Support allocators in tuples of zero size.
* include/std/tuple (tuple<>::tuple(),
	tuple<>::tuple(allocator_arg_t, const _Alloc&),
	tuple<>::tuple(allocator_arg_t, const _Alloc&, const tuple&)): New.
	* testsuite/20_util/tuple/cons/allocators.cc: Adjust.

From-SVN: r237143
2016-06-06 19:28:59 +03:00
Jonathan Wakely
94229fb6dc libstdc++/71320 Add or remove file permissions correctly
PR libstdc++/71320
	* src/filesystem/ops.cc (permissions(const path&, perms, error_code&)):
	Add or remove permissions according to perms argument.
	* testsuite/experimental/filesystem/operations/permissions.cc: New
	test.

From-SVN: r237136
2016-06-06 16:50:01 +01:00
Ville Voutilainen
7a66745357 Protect allocator-overloads of tuple-from-tuple constructors from cases that would create dangling references.
Protect allocator-overloads of tuple-from-tuple constructors
	from cases that would create dangling references.
	* include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
 	const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&,
 	tuple<_UElements...>&&)): Add a check for _NonNestedTuple.
	* testsuite/20_util/tuple/cons/nested_tuple_construct.cc: Adjust.

From-SVN: r237106
2016-06-05 20:39:10 +03:00
Gerald Pfeifer
4acc363412 backwards_compatibility.xml: Adjust lists.debian.org link to https.
* doc/xml/manual/backwards_compatibility.xml: Adjust
	lists.debian.org link to https.
	* doc/html/manual/backwards.html: Regenerate.

From-SVN: r236858
2016-05-29 08:03:35 +00:00
Jonathan Wakely
9020909ef1 Adjust URL in libstdc++ manual to use https
* doc/xml/manual/abi.xml: Adjust URL to use https.
	* doc/html/manual/*: Regenerate.

From-SVN: r236837
2016-05-27 22:23:42 +01:00
Ville Voutilainen
48035dfbea Fix build.
From-SVN: r236823
2016-05-27 17:34:08 +03:00
Ville Voutilainen
b702100693 re PR libstdc++/66338 (std::forward_as_tuple() issue with single argument)
2016-05-24  Ville Voutilainen  <ville.voutilainen@gmail.com>

	PR libstdc++/66338
	* include/std/tuple (_TMC): Add a check for _NotSameTuple.
	* include/std/tuple (tuple(_UElements&&...)): Remove the separate
	check for _NotSameTuple.
	* include/std/tuple (_TMCT): New.
	* include/std/tuple (tuple(const tuple<_UElements...>&)): Use it.
	* include/std/tuple (tuple(tuple<_UElements...>&&)): Likewise.
	* include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
	      const tuple<_UElements...>&)): Likewise.
	* include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
	      tuple<_UElements...>&&)): Likewise.
	* testsuite/20_util/tuple/cons/66338.cc: New.

From-SVN: r236822
2016-05-27 17:08:37 +03:00
Jonathan Wakely
c42d228806 Fix configure test for sendfile()
* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Fix test for sendfile.
	* configure: Regenerate.
	* config.h.in: Regenerate.

From-SVN: r236730
2016-05-25 17:13:52 +01:00
Jonathan Wakely
834f4c4355 Remove _GLIBCXX14_USE_CONSTEXPR
* include/bits/c++config (_GLIBCXX14_USE_CONSTEXPR): Remove it.
	* include/bits/hashtable_policy.h (_Power2_rehash_policy::_M_next_bkt):
	Remove const qualification on function. Replace
	_GLIBCXX14_USE_CONSTEXPR on automatic variables with const.
	(_Power2_rehash_policy::_M_need_rehash): Remove const qualification.
	(_Power2_rehash_policy::_M_next_bkt): Remove mutable specifier.

From-SVN: r236697
2016-05-25 10:36:28 +01:00
François Dumont
732eb07625 c++config (_GLIBCXX14_USE_CONSTEXPR): New.
2016-05-24  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/c++config (_GLIBCXX14_USE_CONSTEXPR): New.
	* include/bits/hashtable_policy.h
	(_Prime_rehash_policy::__has_load_factor): New. Mark rehash policy
	having load factor management.
	(_Mask_range_hashing): New.
	(__clp2): New.
	(_Power2_rehash_policy): New.
	(_Inserts<>): Remove last template parameter, _Unique_keys, so that
	partial specializations only depend on whether iterators are constant
	or not.
	* testsuite/23_containers/unordered_set/hash_policy/26132.cc: Adapt to
	test new hash policy.
	* testsuite/23_containers/unordered_set/hash_policy/load_factor.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/hash_policy/rehash.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/insert/hash_policy.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/max_load_factor/robustness.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/hash_policy/power2_rehash.cc:
	New.
	* testsuite/performance/23_containers/insert/54075.cc: Add benchmark
	using the new hash policy.
	* testsuite/performance/23_containers/insert_erase/41975.cc: Likewise.

From-SVN: r236669
2016-05-24 20:55:57 +00:00
Jonathan Wakely
8be062c6da Add priority_queue::value_compare (LWG 2684)
* include/bits/stl_queue.h (priority_queue::value_compare): Define.

From-SVN: r236646
2016-05-24 16:59:05 +01:00
François Dumont
447caf82a4 2016-05-23 François Dumont <fdumont@gcc.gnu.org>
* include/debug/safe_iterator.h
	(_Safe_iterator<>::operator->()): Implement using underlying iterator
	operator ->.
	* include/debug/safe_local_iterator.h
	(_Safe_local_iterator<>::operator->()): Likewise.

From-SVN: r236611
2016-05-23 20:03:35 +00:00
Thomas Preud'homme
11f8114b51 re PR libstdc++/71081 (experimental/memory_resource/1.cc run for targets without atomics)
2016-05-20  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    PR libstdc++/71081
    * testsuite/experimental/memory_resource/1.cc: Add required argument
    to dg-require-atomic-builtins.

From-SVN: r236507
2016-05-20 12:36:57 +00:00
Jonathan Wakely
541a9b104b libstdc++/71073 add system_header pragma to Debug Mode headers
PR libstdc++/71073
	* include/debug/bitset: Add #pragma GCC system_header.
	* include/debug/deque: Likewise.
	* include/debug/list: Likewise.
	* include/debug/map: Likewise.
	* include/debug/set: Likewise.
	* include/debug/string: Likewise.
	* include/debug/unordered_map: Likewise.
	* include/debug/unordered_set: Likewise.
	* include/debug/vector: Likewise.
	* include/debug/functions.h: Adjust whitespace.

From-SVN: r236211
2016-05-13 15:47:46 +01:00
Jonathan Wakely
068b220e52 Add dg-require-atomic-builtins to test
PR libstdc++/71081
	* testsuite/experimental/memory_resource/1.cc: Require atomics.

From-SVN: r236177
2016-05-12 15:08:45 +01:00
Jonathan Wakely
3d73ae6ea9 libstdc++/71049 fix --disable-libstdcxx-dual-abi bootstrap
PR libstdc++/71049
	* src/c++11/cow-stdexcept.cc [!_GLIBCXX_USE_DUAL_ABI]: Don't define
	exception constructors with __sso_string parameters.

From-SVN: r236118
2016-05-11 13:39:28 +01:00
Jonathan Wakely
7f99d40a99 Test begin and end functions for directory iterators
* include/experimental/bits/fs_dir.h (begin, end): Add noexcept.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Test begin and end functions.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.

From-SVN: r236085
2016-05-10 16:39:20 +01:00
Jonathan Wakely
6fe673ad0f libstdc++/71038 fix error checks in filesystem::copy_file
PR libstdc++/71038
	* src/filesystem/ops.cc (do_copy_file): Fix backwards conditions.
	* testsuite/experimental/filesystem/operations/copy_file.cc: New test.

From-SVN: r236084
2016-05-10 16:39:14 +01:00
Jonathan Wakely
77a87b2a0e Optimize __directory_iterator_proxy for the common case
* include/experimental/bits/fs_dir.h (__directory_iterator_proxy):
	Overload operator* to move from rvalues.

From-SVN: r236078
2016-05-10 14:09:22 +01:00