Commit Graph

3734 Commits

Author SHA1 Message Date
Jonathan Wakely 01e3c2296a Fix Debug Mode test failures
* testsuite/23_containers/array/tuple_interface/
	tuple_element_debug_neg.cc: Adjust dg-error.
	* testsuite/23_containers/list/operations/78389.cc: Fix less-than to
	define a valid strict weak ordering.
	* testsuite/23_containers/priority_queue/67085.cc: Disable test for
	Debug Mode, due to debug checks making extra copies of predicate.
	* testsuite/ext/pb_ds/regression/priority_queue_binary_heap-62045.cc:
	Likewise.

From-SVN: r246426
2017-03-23 19:40:41 +00:00
Daniel Kruegler 7f359d19d0 Implement LWG 2686, std::hash<error_condition>, for C++17
2017-03-23  Daniel Kruegler  <daniel.kruegler@gmail.com>

	Implement LWG 2686, Why is std::hash specialized for error_code,
	but not error_condition?
	* include/std/system_error (hash<error_condition>): Define for C++17.
	* testsuite/20_util/hash/operators/size_t.cc (hash<error_condition>):
	Instantiate test for error_condition.
	* testsuite/20_util/hash/requirements/explicit_instantiation.cc
	(hash<error_condition>): Instantiate hash<error_condition>.

From-SVN: r246424
2017-03-23 19:40:16 +00:00
Daniel Kruegler 288695f7a4 Implement P0607R0 "Inline Variables for Standard Library" for C++17
2017-03-23  Daniel Kruegler  <daniel.kruegler@gmail.com>

	* include/bits/c++config (_GLIBCXX17_INLINE): Define.
	* include/bits/regex_constants.h (All std::regex_constants constants):
	Add _GLIBCXX17_INLINE as per P0607R0.
	* include/bits/std_mutex.h (defer_lock, try_to_lock, adopt_lock):
	Likewise.
	* include/bits/stl_pair.h (piecewise_construct): Likewise.
	* include/bits/uses_allocator.h (allocator_arg, uses_allocator_v)
	(__is_uses_allocator_constructible_v)
	(__is_nothrow_uses_allocator_constructible_v): Likewise.
	* include/std/chrono (treat_as_floating_point_v): Likewise.
	* include/std/functional (is_bind_expression_v, is_placeholder_v):
	Likewise.
	* include/std/optional (nullopt): Likewise.
	* include/std/ratio (ratio_equal_v, ratio_not_equal_v, ratio_less_v)
	ratio_less_equal_v, ratio_greater_v, ratio_greater_equal_v): Likewise.
	* include/std/system_error (is_error_code_enum_v)
	(is_error_condition_enum_v): Likewise.
	* include/std/tuple (tuple_size_v, ignore): Likewise.
	(ignore): Declare ignore constexpr as per LWG 2773, declare assignment
	constexpr as per LWG 2933.
	* include/std/type_traits (All variable templates): Add
	_GLIBCXX17_INLINE as per P0607R0.
	* include/std/variant (variant_size_v, variant_npos, __index_of_v)
	(__tuple_count_v, __exactly_once): Likewise.
	* testsuite/18_support/headers/new/synopsis.cc
	(hardware_destructive_interference_size)
	(hardware_constructive_interference_size): Likewise for commented-out
	variables.
	* testsuite/20_util/tuple/creation_functions/constexpr.cc: Add new
	test function for constexpr std::ignore (LWG 2773).
	* testsuite/20_util/tuple/creation_functions/constexpr_cpp14.cc: New
	test for LWG 2933.

From-SVN: r246423
2017-03-23 19:40:07 +00:00
Jonathan Wakely af181c91a9 Add deduction guides for C++17 (P0433R2, partial)
* include/bits/shared_ptr.h (shared_ptr, weak_ptr): Add deduction
	guides for C++17.
	* include/bits/std_function.h (function): Likewise.
	* include/bits/stl_pair.h (pair): Likewise.
	* include/debug/array (__gnu_debug::array): Likewise.
	* include/std/array (array): Likewise.
	* include/std/functional (make_default_searcher)
	(make_boyer_moore_searcher, make_boyer_moore_horspool_searcher):
	Remove generator functions.
	* include/std/tuple (tuple): Add deduction guides.
	* include/std/valarray (valarray): Likewise.
	* testsuite/20_util/function_objects/searchers.cc: Adjust to use
	class template argument deduction instead of generator functions.
	* testsuite/20_util/function/cons/deduction.cc: New test.
	* testsuite/20_util/optional/cons/deduction_guide.cc: Rename to ...
	* testsuite/20_util/optional/cons/deduction.cc: ... here.
	* testsuite/20_util/pair/cons/deduction.cc: New test.
	* testsuite/20_util/shared_ptr/cons/deduction.cc: New test.
	* testsuite/20_util/tuple/cons/deduction.cc: New test.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Adjust dg-error.
	* testsuite/20_util/unique_ptr/cons/deduction_neg.cc: New test.
	* testsuite/20_util/weak_ptr/cons/deduction.cc: New test.
	* testsuite/23_containers/array/cons/deduction.cc: New test.
	* testsuite/23_containers/array/cons/deduction_neg.cc: New test.
	* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
	Adjust dg-error.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc: Likewise.
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
	Likewise.
	* testsuite/26_numerics/valarray/deduction.cc: New test.
	* testsuite/30_threads/lock_guard/cons/deduction.cc: New test.
	* testsuite/30_threads/scoped_lock/cons/deduction.cc: New test.
	* testsuite/30_threads/unique_lock/cons/deduction.cc: New test.

From-SVN: r246389
2017-03-22 15:58:35 +00:00
Jonathan Wakely d951e75dfe Fix alignment bugs in std::codecvt_utf16
* src/c++11/codecvt.cc (range): Add non-type template parameter and
	define oerloaded operators for reading and writing code units.
	(range<Elem, false>): Define partial specialization for accessing
	wide characters in potentially unaligned byte ranges.
	(ucs2_span(const char16_t*, const char16_t*, ...))
	(ucs4_span(const char16_t*, const char16_t*, ...)): Change parameters
	to range<const char16_t, false> in order to avoid unaligned reads.
	(__codecvt_utf16_base<char16_t>::do_out)
	(__codecvt_utf16_base<char32_t>::do_out)
	(__codecvt_utf16_base<wchar_t>::do_out): Use range specialization for
	unaligned data to avoid unaligned writes.
	(__codecvt_utf16_base<char16_t>::do_in)
	(__codecvt_utf16_base<char32_t>::do_in)
	(__codecvt_utf16_base<wchar_t>::do_in): Likewise for writes. Return
	error if there are unprocessable trailing bytes.
	(__codecvt_utf16_base<char16_t>::do_length)
	(__codecvt_utf16_base<char32_t>::do_length)
	(__codecvt_utf16_base<wchar_t>::do_length): Pass arguments of type
	range<const char16_t, false> to span functions.
	* testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc: New test.

From-SVN: r246245
2017-03-17 19:28:05 +00:00
Jonathan Wakely a4c687d64b PR libstdc++/80041 fix codecvt_utf16<wchar_t> to use UTF-16 not UTF-8
PR libstdc++/80041
	* src/c++11/codecvt.cc (__codecvt_utf16_base<wchar_t>::do_out)
	(__codecvt_utf16_base<wchar_t>::do_in): Convert char arguments to
	char16_t to work with UTF-16 instead of UTF-8.
	* testsuite/22_locale/codecvt/codecvt_utf16/80041.cc: New test.

From-SVN: r246202
2017-03-16 15:28:02 +00:00
Jonathan Wakely 516231de73 Fix encoding() and max_length() values for codecvt facets
* src/c++11/codecvt.cc (codecvt<char16_t, char, mbstate_t>)
	(codecvt<char32_t, char, mbstate_t>, __codecvt_utf8_base<char16_t>)
	(__codecvt_utf8_base<char32_t>, __codecvt_utf8_base<wchar_t>)
	(__codecvt_utf16_base<char16_t>, __codecvt_utf16_base<char32_t>)
	(__codecvt_utf16_base<wchar_t>, __codecvt_utf8_utf16_base<char16_t>)
	(__codecvt_utf8_utf16_base<char32_t>)
	(__codecvt_utf8_utf16_base<wchar_t>): Fix do_encoding() and
	do_max_length() return values.
	* testsuite/22_locale/codecvt/codecvt_utf16/members.cc: New test.
	* testsuite/22_locale/codecvt/codecvt_utf8/members.cc: New test.
	* testsuite/22_locale/codecvt/codecvt_utf8_utf16/members.cc: New test.

From-SVN: r246201
2017-03-16 15:27:57 +00:00
Jonathan Wakely bcd682e1fa PR libstdc++/79980 fix BOM detection, maxcode checks, UCS2 handling
PR libstdc++/79980
	* include/bits/locale_conv.h (__do_str_codecvt): Set __count on
	error path.
	* src/c++11/codecvt.cc (operator&=, operator|=, operator~): Overloads
	for manipulating codecvt_mode values.
	(read_utf16_bom): Compare input to BOM constants instead of integral
	constants that depend on endianness.  Take mode parameter by
	reference and adjust it, to distinguish between no BOM present and
	UTF-16BE BOM present.
	(ucs4_in, ucs2_span, ucs4_span): Adjust calls to read_utf16_bom.
	(surrogates): New enumeration type.
	(utf16_in, utf16_out): Add surrogates parameter to choose between
	UTF-16 and UCS2 behaviour.
	(utf16_span, ucs2_span): Use std::min not std::max.
	(ucs2_out): Use std::min not std::max.  Disallow surrogate pairs.
	(ucs2_in): Likewise. Adjust calls to read_utf16_bom.
	* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: New test.
	* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: New test.

From-SVN: r246200
2017-03-16 15:27:51 +00:00
Jonathan Wakely 02e12bda2d PR libstdc++/79511 fix endianness of UTF-16 data
PR libstdc++/79511
	* src/c++11/codecvt.cc (write_utf16_code_point): Don't write 0xffff
	as a surrogate pair.
	(__codecvt_utf8_utf16_base<char32_t>::do_in): Use native endianness
	for internal representation.
	(__codecvt_utf8_utf16_base<wchar_t>::do_in): Likewise.
	* testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc: New test.

From-SVN: r246199
2017-03-16 15:27:45 +00:00
Jonathan Wakely 8d85abab44 PR libstdc++/80064 make heap algorithms work with function types
PR libstdc++/80064
	* include/bits/stl_heap.h (__is_heap, push_heap, __adjust_heap)
	(pop_heap, make_heap, sort_heap, is_heap_until, is_heap): Cope with
	invalid instantiations using function types for _Compare argument.
	* testsuite/25_algorithms/make_heap/80064.cc: New test.

From-SVN: r246197
2017-03-16 14:32:07 +00:00
Ville Voutilainen df99018275 Implement LWG 2857, {variant,optional,any}::emplace should return the constructed value.
Implement LWG 2857, {variant,optional,any}::emplace should
return the constructed value.
* include/std/any (emplace(_Args&&...)): Change the return type and
return a reference to the constructed value.
(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
* include/std/optional (emplace(_Args&&...)): Likewise.
(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
* include/std/variant (emplace<_Tp>(_Args&&...)): Likewise.
(emplace<_Tp>(initializer_list<_Up>, _Args&&...)): Likewise.
(emplace<_Np>(_Args&&...)): Likewise.
(emplace<_Np>(initializer_list<_Up>, _Args&&...)): Likewise.
* testsuite/20_util/any/assign/emplace.cc: Add tests for
checking the return value of emplace.
* testsuite/20_util/any/misc/any_cast_neg.cc: Adjust.
* testsuite/20_util/optional/assignment/6.cc: Add tests for
checking the return value of emplace.
* testsuite/20_util/variant/run.cc: Likewise.

From-SVN: r246182
2017-03-16 01:13:20 +02:00
Jonathan Wakely 75d359f759 PR libstdc++/62045 fix O(N) insertion in pd_ds binary heap
2017-03-15  Xi Ruoyao  <ryxi@stu.xidian.edu.cn>

	PR libstdc++/62045
	* include/ext/pb_ds/qdetail/binary_heap_/binary_heap_.hpp
	(is_heap): Remove.
	(push_heap): Remove the wrong checking using is_heap.
	(make_heap): Remove the assertion using is_heap.
	* include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
	(modify): Ditto.
	(resize_for_insert_if_needed): Add PB_DS_ASSERT_VALID after
	calling make_heap.

2017-03-15  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/62045
	* testsuite/ext/pb_ds/regression/priority_queue_binary_heap-62045.cc:
	New test.
	* testsuite/ext/pb_ds/regression/priority_queues.cc: Fix copy&paste
	error in comment.

From-SVN: r246173
2017-03-15 20:11:48 +00:00
Jonathan Wakely 4f83482f46 PR libstdc++/79162 disambiguate assignment from string_view
PR libstdc++/79162
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string<C,T,A>::operator=(basic_string_view<C,T>)): Replace
	with a constrained template.
	[!_GLIBCXX_USE_CXX11_ABI]
	(basic_string<C,T,A>::operator=(basic_string_view<C,T>)): Likewise.
	* testsuite/21_strings/basic_string/cons/char/79162.cc: New test.
	* testsuite/21_strings/basic_string/cons/wchar_t/79162.cc: New test.

From-SVN: r246128
2017-03-14 14:51:19 +00:00
Ville Voutilainen 648c989484 re PR libstdc++/80034 (unqualified calls to std::distance in std::list::sort)
PR libstdc++/80034
* include/bits/list.tcc (merge(list&&)): Use const for the size_t
in the catch-block.
(merge(list&&, _StrictWeakOrdering)): Likewise.
* testsuite/23_containers/list/operations/80034.cc: New.

From-SVN: r246107
2017-03-13 21:41:50 +02:00
Ville Voutilainen fd231ad75a Implement LWG 2806, Base class of bad_optional_access.
* include/std/optional (bad_optional_access):
Derive from std::exception.
(bad_optional_access::bad_optional_access): Adjust.
(bad_optional_access::what): New.
(__throw_bad_optional_access(const char*)):
Remove the parameter and adjust calls.
* testsuite/20_util/optional/cons/value_neg.cc: Adjust.
* testsuite/20_util/optional/typedefs.cc: Likewise.

From-SVN: r246103
2017-03-13 20:03:30 +02:00
Ville Voutilainen 06272afbd3 Implement LWG 2934, optional<const T> doesn't compare with T.
* include/std/optional
(operator==(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator==(const optional<_Tp>&, const optional<_Up>&).
(operator!=(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator!=(const optional<_Tp>&, const optional<_Up>&).
(operator<(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator<(const optional<_Tp>&, const optional<_Up>&.
(operator>(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator>(const optional<_Tp>&, const optional<_Up>&.
(operator<=(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator<=(const optional<_Tp>&, const optional<_Up>&).
(operator>=(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator>=(const optional<_Tp>&, const optional<_Up>&).
(operator==(const optional<_Tp>&, const _Tp&)):
Turn into operator==(const optional<_Tp>&, const _Up&).
(operator==(const _Tp&, const optional<_Tp>&)):
Turn into operator==(const _Up&, const optional<_Tp>&).
(operator!=(const optional<_Tp>&, const _Tp&)):
Turn into operator!=(const optional<_Tp>&, const _Up&).
(operator!=(const _Tp&, const optional<_Tp>&)):
Turn into operator!=(const _Up&, const optional<_Tp>&).
(operator<(const optional<_Tp>&, const _Tp&)):
Turn into operator<(const optional<_Tp>&, const _Up&).
(operator<(const _Tp&, const optional<_Tp>&)):
Turn into operator<(const _Up&, const optional<_Tp>&).
(operator>(const optional<_Tp>&, const _Tp&)):
Turn into operator>(const optional<_Tp>&, const _Up&).
(operator>(const _Tp&, const optional<_Tp>&)):
Turn into operator>(const _Up&, const optional<_Tp>&).
(operator<=(const optional<_Tp>&, const _Tp&)):
Turn into operator<=(const optional<_Tp>&, const _Up&).
(operator<=(const _Tp&, const optional<_Tp>&)):
Turn into operator<=(const _Up&, const optional<_Tp>&).
(operator>=(const optional<_Tp>&, const _Tp&)):
Turn into operator>=(const optional<_Tp>&, const _Up&).
(operator>=(const _Tp&, const optional<_Tp>&)):
Turn into operator>=(const _Up&, const optional<_Tp>&).
* testsuite/20_util/optional/relops/7.cc: New.

From-SVN: r246076
2017-03-12 12:32:31 +02:00
Jonathan Wakely da0ced6eb8 Fix libstdc++ reserved names test to pass on AIX
* testsuite/17_intro/names.cc: Undefine macros that clash with
	identifiers in AIX system headers.

From-SVN: r246037
2017-03-10 15:29:49 +00:00
Jonathan Wakely 7dcc645ccd P0604R0 add invoke_result, is_invocable etc. for C++17
* include/bits/invoke.h (__invoke): Use __invoke_result instead of
	result_of, and __is_nothrow_invocable instead of
	__is_nothrow_callable.
	* include/bits/shared_ptr_base.h (__shared_ptr): Use __is_invocable
	instead of __is_callable.
	* include/std/functional (invoke): use invoke_result_t instead of
	result_of_t and is_nothrow_invocable instead of is_nothrow_callable.
	(_Not_fn): Use __invoke_result instead of result_of.
	* include/std/type_traits (__result_of_memobj, __result_of_memfun):
	Remove partial specializations for reference_wrapper types.
	(__result_of_impl): Use __inv_unwrap to strip reference_wrapper.
	(__invoke_result): Define replacement for result_of and then use it to
	define result_of.
	(__is_callable_impl, __is_callable, __is_nothrow_callable): Replace
	with __is_invocable_impl, __is_invocable, and __is_nothrow_invocable
	respectively.
	(invoke_result, invoke_result_t): Define for C++17.
	(is_callable, is_nothrow_callable): Replace with is_invocable,
	is_invocable_r, is_nothrow_invocable, and is_nothrow_invocable_r.
	(is_callable_v, is_nothrow_callable_v): Replace with is_invocable_v,
	is_invocable_r_v, is_nothrow_invocable_v, and is_nothrow_invocable_r_v.
	* include/std/variant (hash<variant<T...>>): Use is_nothrow_invocable_v
	instead of is_nothrow_callable_v.
	* testsuite/20_util/function_objects/invoke/59768.cc: Remove unused
	main function.
	* testsuite/20_util/function_objects/not_fn/1.cc: Use is_invocable
	instead of is_callable.
	* testsuite/20_util/is_callable/*: Rename directory and adjust tests
	to use new traits.
	* testsuite/20_util/is_notjrow_callable/*: Likewise.
	* testsuite/20_util/optional/hash.cc: Use is_invocable_v instead of
	is_callable.
	* testsuite/20_util/variant/hash.cc: Likewise.

From-SVN: r246036
2017-03-10 15:29:38 +00:00
Jonathan Wakely e0472d7e8c Define std::byte for C++17 (P0298R3)
* doc/xml/manual/status_cxx2017.xml: Document std::byte support.
	* include/c_global/cstddef (std::byte): Define for C++17.
	* testsuite/18_support/byte/global_neg.cc: New test.
	* testsuite/18_support/byte/ops.cc: New test.
	* testsuite/18_support/byte/requirements.cc: New test.

From-SVN: r246005
2017-03-09 15:42:02 +00:00
Jonathan Wakely f620e1d5c8 Add std::scoped_lock for C++17
* doc/xml/manual/status_cxx2017.xml: Document P0156R2 status.
	* doc/html/*: Regenerate.
	* include/std/mutex (scoped_lock): Implement new C++17 template.
	* testsuite/30_threads/scoped_lock/cons/1.cc: New test.
	* testsuite/30_threads/scoped_lock/requirements/
	explicit_instantiation.cc: New test.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: New test.

From-SVN: r245903
2017-03-05 18:38:35 +00:00
Jonathan Wakely 17b0b37f58 Rename 17_intro/headers/names.cc test file
* testsuite/17_intro/headers/names.cc: Rename to ...
	* testsuite/17_intro/names.cc: ... here.

From-SVN: r245845
2017-03-02 18:56:57 +00:00
Jonathan Wakely d34d36ef0d PR libstdc++/79789 fix non-reserved names in headers
PR libstdc++/79789
	* include/bits/hashtable_policy.h (__clp2): Use reserved names for
	parameters and local variables.
	* include/bits/ios_base.h (make_error_code, make_error_condition):
	Likewise.
	* include/bits/list.tcc (list::sort): Likewise.
	* include/bits/mask_array.h (mask_array): Likewise.
	* include/bits/regex.h (regex_token_iterator): Likewise.
	* include/bits/slice_array.h (slice_array): Likewise.
	* include/bits/stl_algo.h (__sample): Likewise.
	* include/std/memory (undeclare_no_pointers): Likewise.
	* include/std/type_traits (is_callable_v, is_nothrow_callable_v):
	Likewise.
	* libsupc++/exception_ptr.h (__dest_thunk): Likewise.
	* testsuite/17_intro/headers/names.cc: New test.

From-SVN: r245828
2017-03-02 03:43:49 +00:00
Jonathan Wakely 5782e30941 PR 79798 Fix incorrect use of std::result_of in std::bind
PR libstdc++/79798
	* include/std/functional (bind::_Res_type_impl): Fix incorrect use of
	result_of that loses top-level cv-qualifiers.
	* testsuite/20_util/bind/79798.cc: New test.

From-SVN: r245827
2017-03-02 03:43:36 +00:00
Jonathan Wakely cb701078b1 Ensure <experimental/iterator> includes <iterator>
* include/experimental/iterator: Include <iterator>.
	* testsuite/experimental/iterator/requirements.cc: Check for contents
	of <iterator>.

From-SVN: r245686
2017-02-23 18:25:22 +00:00
Dinka Ranns 1dee318ad8 C++17 GB50 resolution (P0505R0)
2017-02-19  Dinka Ranns  <dinka.ranns@googlemail.com>

	C++17 GB50 resolution
	* include/std/chrono (duration::operator++()): Add
	_GLIBCXX17_CONSTEXPR.
	(duration::operator++(int)): Likewise.
	(duration::operator--()): Likewise.
	(duration::operator--(int)): Likewise.
	(duration::operator+=(const duration&)): Likewise.
	(duration::operator-=(const duration&)): Likewise.
	(duration::operator*=(const rep&)): Likewise.
	(duration::operator/=(const rep&)): Likewise.
	(duration::operator%=(const rep&)): Likewise.
	(duration::operator%=(const duration&)): Likewise.
	(time_point::operator+=(const duration&)): Likewise.
	(time_point::operator-=(const duration&)): Likewise.
	* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: New test.
	* testsuite/20_util/duration/literals/range.cc: Adjust dg-error.
	* testsuite/20_util/time_point/arithmetic/constexpr.cc: New test.

From-SVN: r245575
2017-02-19 16:04:35 +00:00
Tim Shen d255829bbc re PR libstdc++/78723 ([variant] P0393r3: "Making variant greater equal again" is unimplemented)
PR libstdc++/78723
	* include/std/variant (operator<(), operator>(), operator<=(),
	operator>=(), operator==(), operator!=()): Implement P0393R3.
	* testsuite/20_util/variant/compile.cc: Adjust tests.
	* testsuite/20_util/variant/run.cc: Adjust tests.

From-SVN: r245475
2017-02-15 09:01:06 +00:00
Tim Shen 7d5abe42c2 re PR libstdc++/79513 (std::visit doesn't handle references)
PR libstdc++/79513
	* include/std/variant (visit()): Forward variant types to the return
	type detection code.
	* testsuite/20_util/variant/compile.cc: Add test cases.

From-SVN: r245474
2017-02-15 07:38:20 +00:00
Jonathan Wakely def227f1ad PR libstdc++/79486 use lvalues in result_of expressions
PR libstdc++/79486
	* include/std/future (__future_base::_Task_state::_M_run)
	(__future_base::_Task_state::_M_run_delayed): Use lvalue types in
	result_of expressions.
	* testsuite/30_threads/packaged_task/79486.cc: New.

From-SVN: r245386
2017-02-13 13:13:29 +00:00
Jonathan Wakely 99ebfe9075 PR libstdc++/79467 use lvalues in is_callable check
PR libstdc++/79467
	* include/bits/shared_ptr_base.h (__shared_ptr(_Yp*, _Deleter))
	(__shared_ptr(_Yp*, _Deleter, _Alloc)): Use lvalue types in
	__is_callable check.
	* testsuite/20_util/shared_ptr/cons/79467.cc: New.

From-SVN: r245363
2017-02-11 21:08:11 +00:00
Jonathan Wakely 3e4fd831e9 Fix test failure at -O0 by pruning output
PR libstdc++/79323
	* testsuite/20_util/duration/literals/range.cc: Prune extra output
	at -O0.

From-SVN: r245211
2017-02-06 16:39:56 +00:00
Jonathan Wakely 10613537a9 PR libstdc++/66145 ensure new ABI for ios::failure tests
PR libstdc++/66145
	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Restore ABI override
	so new ios::failure can be caught even when old ABI is the default.
	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/ios_base/storage/2.cc: Likewise.

From-SVN: r245167
2017-02-03 19:26:51 +00:00
Jonathan Wakely 2cf9276ba7 PR78346 make <bits/predefined_ops.h> handle stashing iterators
PR libstdc++/78346
	* include/bits/predefined_ops.h (_Iter_equals_iter): Store iterator
	not its referent.
	(_Iter_comp_to_iter): Likewise.
	* testsuite/25_algorithms/search/78346.cc: New test.

From-SVN: r245090
2017-02-01 12:57:35 +00:00
Jonathan Wakely 11d10beb57 PR libstdc++/79254 simplify exception-safety in copy assignment
PR libstdc++/79254
	* config/abi/pre/gnu.ver: Remove recently added symbols.
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_M_copy_assign): Remove.
	(basic_string::operator=(const basic_string&)): Don't dispatch to
	_M_copy_assign. If source object is small just deallocate, otherwise
	perform new allocation before making any changes.
	* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_M_copy_assign(const basic_string&, true_type)):
	Remove.
	* testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
	Test cases where the allocators are equal or the string is small.
	* testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
	Likewise.

From-SVN: r245085
2017-02-01 11:41:48 +00:00
Ville Voutilainen 1dd9523917 Implement LWG 2825, LWG 2756 breaks class template argument deduction for optional.
* include/std/optional: Add a deduction guide.
* testsuite/20_util/optional/cons/deduction_guide.cc: New.

From-SVN: r245024
2017-01-30 15:37:16 +02:00
Jonathan Wakely a7d47f3526 PR libstdc++/79254 fix exception-safety in std::string::operator=
PR libstdc++/79254
	* config/abi/pre/gnu.ver: Add new symbols.
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_M_copy_assign): New overloaded functions to perform
	copy assignment.
	(basic_string::operator=(const basic_string&)): Dispatch to
	_M_copy_assign.
	* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_M_copy_assign(const basic_string&, true_type)):
	Define, performing rollback on exception.
	* testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
	Test exception-safety guarantee.
	* testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
	Likewise.
	* testsuite/util/testsuite_allocator.h (uneq_allocator::swap): Make
	std::swap visible.

From-SVN: r244986
2017-01-27 16:17:04 +00:00
Jonathan Wakely 881191e865 Fix libstdc++ testsuite failures in C++98 and C++11 mode
* testsuite/23_containers/list/operations/78389.cc: Fix for C++11
	mode.
	* testsuite/23_containers/priority_queue/requirements/constructible.cc:
	Mark as unsupported in C++98 mode.
	* testsuite/23_containers/queue/requirements/constructible.cc:
	Likewise.
	* testsuite/23_containers/stack/requirements/constructible.cc:
	Likewise.
	* testsuite/25_algorithms/make_heap/movable.cc: Fix for C++11 mode.

From-SVN: r244950
2017-01-26 19:39:53 +00:00
Jakub Jelinek 68edb9bafe update-copyright.py: Add libhsail-rt to self.default_dirs and call self.add_dir on it.
contrib/
	* update-copyright.py: Add libhsail-rt to self.default_dirs
	and call self.add_dir on it.  Add Intel Corporation to external
	authors.
gcc/
	* brig-builtins.def: Update copyright years.
	* config/arm/arm_acle_builtins.def: Update copyright years.
gcc/brig/
	Update copyright years.
gcc/testsuite/
	* brig.dg/dg.exp: Update copyright years.
	* lib/brig-dg.exp: Update copyright years.
	* lib/brig.exp: Update copyright years.
libhsail-rt/
	Update copyright years.
libstdc++-v3/
	* libsupc++/eh_atomics.h: Update copyright years.
	* testsuite/20_util/unique_ptr/cons/default.cc: Update copyright years.

From-SVN: r244919
2017-01-26 09:24:22 +01:00
Jonathan Wakely 536c221d20 PR libstdc++/70607 make proj(T) and conj(T) return complex<T>
PR libstdc++/61791
	PR libstdc++/70607
	* include/std/complex (real(T), imag(T)): Add _GLIBCXX_CONSTEXPR.
	(proj(T), conj(T)): Change return types per DR 1522.
	* include/tr1/complex (conj): Remove overloads and use std::conj.
	* testsuite/26_numerics/complex/dr781_dr1137.cc: Rename to...
	* testsuite/26_numerics/complex/dr781.cc: ... this, and update.
	* testsuite/26_numerics/complex/value_operations/constexpr2.cc: Test
	real(T) and imag(T). Allow testing for C++11 too.

From-SVN: r244900
2017-01-25 15:01:05 +00:00
Jonathan Wakely 11948d8394 Restore <functional> header to test
* testsuite/experimental/array/make_array.cc: Restore <functional>
	inclusion.

From-SVN: r244840
2017-01-23 23:59:08 +00:00
Thomas Preud'homme a750159e3b 69301.cc: Require atomic builtins.
2017-01-23  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    libstdc++-v3/
    * testsuite/29_atomics/atomic/69301.cc: Require atomic builtins.

From-SVN: r244819
2017-01-23 17:18:04 +00:00
Jonathan Wakely 61ad58f3aa PR libstdc++/79195 fix make_array type deduction
PR libstdc++/79195
	* include/experimental/array (__make_array_elem): New class template
	and partial specialization.
	(__is_reference_wrapper): Move into __make_array_elem specialization.
	(make_array): Use __make_array_elem to determine element type and move
	static assertion into specialization. Qualify std::forward call.
	(to_array): Add exception specifiation.
	* testsuite/experimental/array/make_array.cc: Test argument types
	without a common type.
	* testsuite/experimental/array/neg.cc: Adjust expected error message.

From-SVN: r244813
2017-01-23 15:56:05 +00:00
Ville Voutilainen 509912a611 Make poisoned hashes SFINAE away the call operator of the hash.
* include/bits/functional_hash.h
(__poison_hash::__enable_hash_call): New.
* include/std/optional (__optional_hash_call_base): New.
(hash<optional<_Tp>>): Derive from the new base,
move the hash function into that base.
* include/std/variant (__variant_hash_call_base_impl): New.
(__variant_hash_call_base): Likewise.
(hash<variant<_Types...>>): Derive from the new base,
move the hash function into that base.
* testsuite/20_util/optional/hash.cc: Add tests for is_callable.
* testsuite/20_util/variant/hash.cc: Likewise.

From-SVN: r244748
2017-01-21 17:38:23 +02:00
Jonathan Wakely 12905f106c PR69240 Define inequality operators for <random> param types
PR libstdc++/69240
	* include/bits/random.h (uniform_real_distribution::param_type)
	(normal_distribution::param_type, lognormal_distribution::param_type)
	(gamma_distribution::param_type, chi_squared_distribution::param_type)
	(cauchy_distribution::param_type, fisher_f_distribution::param_type)
	(student_t_distribution::param_type)
	(bernoulli_distribution::param_type, binomial_distribution::param_type)
	(geometric_distribution::param_type)
	(negative_binomial_distribution::param_type)
	(poisson_distribution::param_type)
	(exponential_distribution::param_type)
	(weibull_distribution::param_type)
	(extreme_value_distribution::param_type)
	(discrete_distribution::param_type)
	(piecewise_constant_distribution::param_type)
	(piecewise_linear_distribution::param_type): Define operator!=.
	* include/bits/uniform_int_dist.h
	(uniform_int_distribution::param_type): Likewise.
	* include/ext/random (beta_distribution::param_type)
	(rice_distribution::param_type, nakagami_distribution::param_type)
	(pareto_distribution::param_type, k_distribution::param_type)
	(arcsine_distribution::param_type, hoyt_distribution::param_type)
	(triangular_distribution::param_type)
	(von_mises_distribution::param_type)
	(hypergeometric_distribution::param_type)
	(logistic_distribution::param_type)
	(uniform_on_sphere_distribution::param_type)
	(uniform_inside_sphere_distribution::param_type): Likewise.
	* testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc:
	Test construction with param_type.
	* testsuite/26_numerics/random/binomial_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/exponential_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/extreme_value_distribution/cons/
	parms.cc: Likewise.
	* testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/gamma_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/geometric_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/cons/
	parms.cc: Likewise.
	* testsuite/26_numerics/random/normal_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/poisson_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/student_t_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/weibull_distribution/cons/parms.cc:
	Likewise.
	* testsuite/ext/random/arcsine_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/beta_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/hoyt_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/hypergeometric_distribution/cons/parms.cc:
	Likewise.
	* testsuite/ext/random/k_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/logistic_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/nakagami_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/normal_mv_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/pareto_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/rice_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/triangular_distribution/cons/parms.cc:
	Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/cons/
	parms.cc: Likewise.
	* testsuite/ext/random/von_mises_distribution/cons/parms.cc: Likewise.

From-SVN: r244722
2017-01-20 15:28:48 +00:00
Jonathan Wakely 4dfdda108f PR72792 detect allocator pointer types without invalid rebinding
PR libstdc++/72792
	* include/bits/alloc_traits.h (__allocator_traits_base::__diff_type)
	(__allocator_traits_base::__size_type): Remove.
	(allocator_traits::_Ptr): New class template to detect const and void
	pointer types without instantiating pointer_traits::rebind
	unnecessarily.
	(allocator_traits::_Diff): Likewise for detecting difference_type.
	(allocator_traits::_Size): New class template to detect size_type
	without instantiating make_unsigned unnecessarily.
	* include/bits/ptr_traits.h (pointer_traits::element_type): Use
	__detected_or_t instead of __detected_or_t_.
	* include/std/type_traits (__detected_or_t_): Remove.
	* testsuite/20_util/allocator_traits/members/pointers.cc: New test.

From-SVN: r244706
2017-01-20 12:03:36 +00:00
Jonathan Wakely a3a1620bb8 PR72792 PR72793 relax requirements on rebind members
PR libstdc++/72792
	PR libstdc++/72793
	* include/bits/alloc_traits.h (__allocator_traits_base::__rebind):
	Replace with class template using void_t.
	(__alloc_rebind): Define in terms of
	__allocator_traits_base::__rebind.
	(allocator_traits): Remove unconditional static_assert for
	rebind_alloc.
	* include/bits/ptr_traits.h (__replace_first_arg): Remove type member.
	(pointer_traits::__rebind): Replace with class template using void_t.
	(pointer_traits::rebind): Define in terms of __rebind.
	(pointer_traits): Remove unconditional static_assert for rebind.
	* testsuite/20_util/allocator_traits/members/rebind_alloc.cc: New test.
	* testsuite/20_util/pointer_traits/rebind.cc: New test.

From-SVN: r244680
2017-01-20 02:36:16 +00:00
Jonathan Wakely 38a9e5a6c0 PR69321 fix any_cast<T>(any*) for non-copyable T
PR libstdc++/69321
	* include/experimental/any (__any_caster): Avoid instantiating
	manager function for types that can't be stored in any.
	* include/std/any (__any_caster): Likewise.
	* testsuite/20_util/any/misc/any_cast.cc: Test non-copyable type.
	* testsuite/experimental/any/misc/any_cast.cc: Likewise.

From-SVN: r244678
2017-01-20 01:22:54 +00:00
Jonathan Wakely 115ac9ff61 PR79156 fix std::__enable_shared_from_this extension
PR libstdc++/79156
	* include/bits/shared_ptr_base.h (__enable_shared_from_this_base):
	Fix return type.
	(__enable_shared_from_this): Declare __shared_ptr as a friend.
	* testsuite/ext/shared_ptr/1.cc: New test.

From-SVN: r244668
2017-01-20 00:07:14 +00:00
Jonathan Wakely c4e5baa663 PR64903 fix number of predicate tests in std::is_partitioned
PR libstdc++/64903
	* include/bits/stl_algo.h (is_partioned): Don't retest the partition
	point.
	* testsuite/25_algorithms/is_partitioned/2.cc: New test.

From-SVN: r244661
2017-01-19 23:30:18 +00:00
Jonathan Wakely 437f43cc78 PR67085 pass comparison functions by reference in heap algorithms
PR libstdc++/67085
	* include/bits/predefined_ops.h (_Iter_less_val, _Val_less_iter): Add
	converting constructors from _Iter_less_iter.
	(_Iter_comp_val, _Val_comp_iter): Add converting constructors from
	_Iter_comp_iter.
	(__iter_comp_val(_Iter_comp_iter<C>): Use converting constructor.
	(__val_comp_iter(_Iter_comp_iter<C>): Likewise.
	* include/bits/stl_heap.h (__is_heap_until, __push_heap, __pop_heap)
	(__make_heap, __sort_heap): Change _Compare parameters to references.
	(__is_heap, push_heap, __adjust_heap, __pop_heap, pop_heap)
	(__make_heap, make_heap, sort_heap, is_heap_until): Pass comparison
	functions as lvalues.
	(is_heap): Call __is_heap_until directly to avoid copying __comp.
	* testsuite/23_containers/priority_queue/67085.cc: Adjust test to
	count copies during construction with empty sequence.

From-SVN: r244656
2017-01-19 23:07:52 +00:00
Jonathan Wakely 9ade9945a0 Fix unsafe moves inside loops
PR libstdc++/67085
	* include/bits/stl_heap.h (__is_heap): Use _GLIBCXX_MOVE.
	(__make_heap, __sort_heap): Don't use _GLIBCXX_MOVE inside loops.
	* testsuite/23_containers/priority_queue/67085.cc: Adjust expected
	number of copies.
	* testsuite/25_algorithms/make_heap/movable.cc: New test.

From-SVN: r244650
2017-01-19 20:29:07 +00:00