Commit Graph

10068 Commits

Author SHA1 Message Date
GCC Administrator b1a2242e24 Daily bump. 2020-12-19 00:16:31 +00:00
GCC Administrator cd69e3d5cd Daily bump. 2020-12-18 00:16:30 +00:00
GCC Administrator eefe499fdf Daily bump. 2020-12-17 00:16:37 +00:00
GCC Administrator 6e9d865119 Daily bump. 2020-12-16 00:16:31 +00:00
GCC Administrator d52945ce54 Daily bump. 2020-12-15 00:16:35 +00:00
GCC Administrator 9855e8a90d Daily bump. 2020-12-13 00:16:19 +00:00
GCC Administrator 35af87784e Daily bump. 2020-12-11 18:22:52 +00:00
GCC Administrator ca2bd94949 Daily bump. 2020-12-10 00:16:47 +00:00
GCC Administrator f6e8e2797e Daily bump. 2020-12-09 00:16:50 +00:00
GCC Administrator 6e1edf48eb Daily bump. 2020-12-06 00:16:44 +00:00
GCC Administrator c5fd8a9157 Daily bump. 2020-12-05 00:16:39 +00:00
GCC Administrator b8dd0ef74d Daily bump. 2020-12-04 00:16:36 +00:00
GCC Administrator 11860cf440 Daily bump. 2020-12-03 00:16:47 +00:00
GCC Administrator e0f5e79267 Daily bump. 2020-12-02 00:16:41 +00:00
GCC Administrator 94358e4770 Daily bump. 2020-12-01 00:16:38 +00:00
GCC Administrator a9625c50dd Daily bump. 2020-11-30 00:16:27 +00:00
GCC Administrator e87559d202 Daily bump. 2020-11-28 00:16:38 +00:00
GCC Administrator d48df6f24b Daily bump. 2020-11-27 00:16:31 +00:00
GCC Administrator 360258daf5 Daily bump. 2020-11-26 00:16:41 +00:00
GCC Administrator 1e2c9a2761 Daily bump. 2020-11-25 09:34:01 +00:00
GCC Administrator 8e6198d0f8 Daily bump. 2020-11-24 00:16:44 +00:00
GCC Administrator 7a97e2fcf7 Daily bump. 2020-11-22 00:16:24 +00:00
GCC Administrator 82e5048e70 Daily bump. 2020-11-21 00:16:29 +00:00
GCC Administrator d62586ee56 Daily bump. 2020-11-20 00:16:40 +00:00
GCC Administrator 25bb75f841 Daily bump. 2020-11-19 00:16:30 +00:00
GCC Administrator 4dabb03719 Daily bump. 2020-11-18 00:16:34 +00:00
GCC Administrator 29c5d9ceb9 Daily bump. 2020-11-17 00:16:27 +00:00
GCC Administrator cba306519c Daily bump. 2020-11-16 00:16:31 +00:00
GCC Administrator 77f67db2a4 Daily bump. 2020-11-14 00:16:38 +00:00
GCC Administrator a5a115258a Daily bump. 2020-11-13 00:16:35 +00:00
GCC Administrator 0f5f9ed5e5 Daily bump. 2020-11-12 00:16:39 +00:00
GCC Administrator bb6226419f Daily bump. 2020-11-11 00:16:36 +00:00
GCC Administrator 2bee28dd41 Daily bump. 2020-11-10 00:16:24 +00:00
GCC Administrator 2da7ee050c Daily bump. 2020-11-08 00:16:31 +00:00
GCC Administrator 44cab2d8fd Daily bump. 2020-11-07 00:16:39 +00:00
GCC Administrator 0cfd9109e5 Daily bump. 2020-11-06 00:16:34 +00:00
Jonathan Wakely d16d45655d libstdc++: Fix typo in ChangeLog entry 2020-11-05 19:35:34 +00:00
GCC Administrator 35c125cb6a Daily bump. 2020-11-05 00:16:36 +00:00
GCC Administrator fd2325ea60 Daily bump. 2020-11-04 00:16:41 +00:00
GCC Administrator 88ce3d5fbb Daily bump. 2020-11-02 20:53:00 +00:00
GCC Administrator 4f0606fe4b Daily bump. 2020-10-30 00:16:29 +00:00
Patrick Palka 64817472be libstdc++: Correct PR number in ChangeLog entry 2020-10-29 09:28:43 -04:00
GCC Administrator e93aae4a49 Daily bump. 2020-10-29 00:16:50 +00:00
GCC Administrator 89bb01e7cb Daily bump. 2020-10-28 00:16:38 +00:00
GCC Administrator f19e7c8d5b Daily bump. 2020-10-27 00:16:28 +00:00
GCC Administrator efe71fcc4c Daily bump. 2020-10-24 00:16:29 +00:00
GCC Administrator 43868df37b Daily bump. 2020-10-23 00:16:30 +00:00
GCC Administrator 56ddd5e23a Daily bump. 2020-10-22 08:28:22 +00:00
GCC Administrator e2e0428854 Daily bump. 2020-10-21 00:16:36 +00:00
GCC Administrator 970d683f67 Daily bump. 2020-10-20 00:16:29 +00:00
GCC Administrator 019e1c85fe Daily bump. 2020-10-18 00:16:23 +00:00
GCC Administrator b85d5dc583 Daily bump. 2020-10-16 00:16:29 +00:00
GCC Administrator b2698c21f2 Daily bump. 2020-10-15 00:16:34 +00:00
GCC Administrator bdd74cc20c Daily bump. 2020-10-14 00:16:24 +00:00
GCC Administrator 8be127cac9 Daily bump. 2020-10-13 00:16:26 +00:00
GCC Administrator 2baa36d491 Daily bump. 2020-10-12 00:16:25 +00:00
GCC Administrator aab566a4fb Daily bump. 2020-10-11 00:16:25 +00:00
GCC Administrator c74a0e82fa Daily bump. 2020-10-10 00:16:26 +00:00
GCC Administrator da9df69975 Daily bump. 2020-10-09 00:16:27 +00:00
GCC Administrator 6caec77e3b Daily bump. 2020-10-08 00:16:30 +00:00
GCC Administrator 8e97b9052d Daily bump. 2020-10-07 00:16:35 +00:00
GCC Administrator 7e9282ae62 Daily bump. 2020-10-06 00:16:25 +00:00
Jonathan Wakely b98d3cc566 libstdc++: Add missing bugzilla PR numbers to ChangeLog
We missed these out of the git commit messages.
2020-10-05 10:46:25 +01:00
GCC Administrator b0b9b8f02a Daily bump. 2020-10-03 00:16:25 +00:00
GCC Administrator 6c2675fa2b Daily bump. 2020-10-02 00:16:27 +00:00
GCC Administrator 660bfe61d4 Daily bump. 2020-10-01 00:16:30 +00:00
GCC Administrator e84761c6f3 Daily bump. 2020-09-29 00:16:30 +00:00
GCC Administrator 4383c595ce Daily bump. 2020-09-28 00:16:21 +00:00
GCC Administrator 91dd4a3864 Daily bump. 2020-09-27 00:16:24 +00:00
GCC Administrator cdd8f031c7 Daily bump. 2020-09-26 00:16:25 +00:00
GCC Administrator a2b7397b50 Daily bump. 2020-09-25 00:16:27 +00:00
GCC Administrator 521d271140 Daily bump. 2020-09-23 00:16:27 +00:00
GCC Administrator 44135373fc Daily bump. 2020-09-22 00:16:31 +00:00
GCC Administrator 11da31998a Daily bump. 2020-09-21 00:16:24 +00:00
GCC Administrator ac35c09082 Daily bump. 2020-09-12 00:16:30 +00:00
GCC Administrator fdcc0283c6 Daily bump. 2020-09-11 00:16:28 +00:00
GCC Administrator a995c40d03 Daily bump. 2020-09-08 00:16:32 +00:00
GCC Administrator 6e82b6cfcf Daily bump. 2020-09-04 00:16:32 +00:00
GCC Administrator 6a8f4e47c9 Daily bump. 2020-09-03 00:16:26 +00:00
GCC Administrator e1a4a8a03f Daily bump. 2020-09-02 00:16:25 +00:00
GCC Administrator daba4a713e Daily bump. 2020-08-30 00:16:20 +00:00
GCC Administrator 8f7ea26ae3 Daily bump. 2020-08-29 00:16:21 +00:00
GCC Administrator 8b394f011a Daily bump. 2020-08-28 00:16:24 +00:00
GCC Administrator 57ea089421 Daily bump. 2020-08-27 00:16:27 +00:00
Patrick Palka e9a2b5b8a3 libstdc++: Add missing extra space to ChangeLog author lines 2020-08-26 09:35:07 -04:00
Patrick Palka 121dc0c378 libstdc++: Add missing coauthors to ChangeLog entry
The corresponding commit had the Co-authored-by: lines in the middle of
the commit message instead of at the end, so the ChangeLog script didn't
consider them.
2020-08-26 09:29:39 -04:00
GCC Administrator db0f6efe7a Daily bump. 2020-08-26 00:16:32 +00:00
GCC Administrator b2b24d30bb Daily bump. 2020-08-25 00:16:24 +00:00
GCC Administrator 3eeede6de7 Daily bump. 2020-08-22 00:16:24 +00:00
GCC Administrator 5b9a3d2a05 Daily bump. 2020-08-21 00:16:23 +00:00
Jonathan Wakely 1531d8df6e libstdc++: Fix typo in ChangeLog 2020-08-20 21:56:43 +01:00
GCC Administrator 04e23a4051 Daily bump. 2020-08-20 00:16:34 +00:00
GCC Administrator 5c265693bf Daily bump. 2020-08-19 00:16:23 +00:00
GCC Administrator deee2322a2 Daily bump. 2020-08-18 00:16:26 +00:00
GCC Administrator 661ee09b8b Daily bump. 2020-08-15 00:16:22 +00:00
GCC Administrator b3cb56060b Daily bump. 2020-08-14 00:16:24 +00:00
GCC Administrator afdd220a0c Daily bump. 2020-08-13 00:16:23 +00:00
Jonathan Wakely 86f8741485 libstdc++: ChangeLog corrections
I got the name of the __stat64 type wrong in r11-2628 and missed the
bugzilla PR number in r11-2632.
2020-08-12 20:42:04 +01:00
GCC Administrator a64938091b Daily bump. 2020-08-12 00:16:27 +00:00
GCC Administrator 84005b8abf Daily bump. 2020-08-11 00:16:45 +00:00
GCC Administrator a72e938d71 Daily bump. 2020-08-08 00:16:34 +00:00
GCC Administrator 74d91e8bb7 Daily bump. 2020-08-07 00:16:33 +00:00
GCC Administrator aa5ea20c2b Daily bump. 2020-08-06 00:16:26 +00:00
GCC Administrator 4967ca2f8b Daily bump. 2020-08-02 00:16:21 +00:00
GCC Administrator 48cc2e468c Daily bump. 2020-08-01 00:16:25 +00:00
Jonathan Wakely 89db36b05e libstdc++: Add PR number to ChangeLog entry 2020-07-31 14:15:43 +01:00
GCC Administrator d48cca8f21 Daily bump. 2020-07-31 00:16:26 +00:00
GCC Administrator bea7a39103 Daily bump. 2020-07-30 00:16:24 +00:00
GCC Administrator 7ebb7d0ce1 Daily bump. 2020-07-29 00:16:24 +00:00
GCC Administrator e71dab8774 Daily bump. 2020-07-28 00:16:25 +00:00
GCC Administrator 3ea9abca71 Daily bump. 2020-07-23 00:16:28 +00:00
GCC Administrator 0933f50859 Daily bump. 2020-07-21 00:16:28 +00:00
GCC Administrator ab660b01c3 Daily bump. 2020-07-18 00:16:24 +00:00
GCC Administrator 8ca07a3072 Daily bump. 2020-07-15 00:16:35 +00:00
GCC Administrator ea69fcf9a0 Daily bump. 2020-07-14 00:16:30 +00:00
GCC Administrator 50873cc588 Daily bump. 2020-07-09 00:16:44 +00:00
GCC Administrator f60ee68de3 Daily bump. 2020-07-08 00:16:40 +00:00
Jonathan Wakely 92cae0785e libstdc++: Add PR number to ChangeLog entry and fix typos 2020-07-07 08:23:12 +01:00
GCC Administrator 4077d74c6d Daily bump. 2020-07-07 00:16:40 +00:00
GCC Administrator b5f2473963 Daily bump. 2020-07-03 00:16:25 +00:00
GCC Administrator 64f761e4ac Daily bump. 2020-07-02 00:16:26 +00:00
GCC Administrator 458f12eda1 Daily bump. 2020-06-30 09:02:21 +00:00
GCC Administrator 69273534c6 Daily bump. 2020-06-29 00:16:29 +00:00
GCC Administrator 2e546c261b Daily bump. 2020-06-25 00:16:30 +00:00
GCC Administrator 4543acc874 Daily bump. 2020-06-24 00:16:31 +00:00
GCC Administrator 605a8f3bbc Daily bump. 2020-06-23 00:16:23 +00:00
GCC Administrator f86e11a267 Daily bump. 2020-06-22 00:16:23 +00:00
GCC Administrator bbac3886a2 Daily bump. 2020-06-21 00:16:21 +00:00
GCC Administrator e37658dffd Daily bump. 2020-06-20 00:16:27 +00:00
GCC Administrator aff95ee7cc Daily bump. 2020-06-18 00:16:37 +00:00
GCC Administrator 56638b9b18 Daily bump. 2020-06-17 00:16:36 +00:00
GCC Administrator 6fb94d67f1 Daily bump. 2020-06-16 00:16:28 +00:00
GCC Administrator 8e3b453e08 Daily bump. 2020-06-13 00:16:25 +00:00
GCC Administrator e68e80c8dd Daily bump. 2020-06-12 00:16:29 +00:00
GCC Administrator ec6ffbb919 Daily bump. 2020-06-11 00:16:45 +00:00
GCC Administrator b952c2cfcd Daily bump. 2020-06-10 00:16:47 +00:00
GCC Administrator 2c455ae06c Daily bump. 2020-06-09 00:16:47 +00:00
GCC Administrator 3add342502 Daily bump. 2020-06-05 00:16:30 +00:00
GCC Administrator a9312a7926 Daily bump. 2020-06-03 00:16:34 +00:00
GCC Administrator 4a9aa9dec7 Daily bump. 2020-06-02 00:16:25 +00:00
GCC Administrator e7340ed74a Daily bump. 2020-06-01 00:16:26 +00:00
GCC Administrator 885ef72f27 Daily bump. 2020-05-30 00:16:27 +00:00
GCC Administrator 61f3b60556 Daily bump. 2020-05-28 04:23:50 +00:00
GCC Administrator c3a4169be9 Daily bump. 2020-05-27 07:45:56 +00:00
Patrick Palka a57aa11191 libstdc++: Compile PR93978 testcase with -Wall
Now that the frontend issue PR c++/94038 is thoroughly fixed, the
testcase for PR93978 no longer fails to compile with -O -Wall, so add
-Wall to the testcase's compile flags to help ensure we don't regress
here.

libstdc++-v3/ChangeLog:

	PR libstdc++/93978
	* testsuite/std/ranges/adaptors/93978.cc: Add -Wall to
	dg-additional-options.  Avoid unused-but-set-variable warning.
2020-05-23 15:25:40 -04:00
Jonathan Wakely 3cb0c7cc16 libstdc++: Fix function that can't be constexpr in C++11 (PR 95289)
The body of this function isn't just a return statement, so it can't be
constexpr until C++14.

	PR libstdc++/95289
	* include/debug/helper_functions.h (__get_distance): Only declare
	as a constexpr function for C++14 and up.
	* testsuite/25_algorithms/copy/debug/95289.cc: New test.
2020-05-23 18:27:35 +01:00
Jonathan Wakely 584d52b088 libstdc++: Refactor filesystem::path string conversions
This simplifies the logic of converting Source arguments and pairs of
InputIterator arguments into the native string format. For any input
that is a contiguous range of path::value_type (or char8_t for POSIX)
a string view can be created and the conversion can be done directly,
with no intermediate allocation. Previously some cases created a
basic_string unnecessarily, for example construction from a pair of
path::string_type::iterators, or a pair of non-const value_type*
pointers.

	* include/bits/fs_path.h (__detail::_S_range_begin)
	(__detail::_S_range_end, path::_S_string_from_iter): Replace with
	overloaded function template __detail::__effective_range.
	(__detail::__effective_range): New overloaded function template to
	create a basic_string or basic_string_view for an effective range.
	(__detail::__value_type_is_char): Use __detail::__effective_range.
	Do not use remove_const on value type.
	(__detail::__value_type_is_char_or_char8_t): Likewise.
	(path::path(const Source&, format))
	(path::path(const Source&, const locale&))
	(path::operator/=(const Source&), path::append(const Source&))
	(path::concat(const Source&)): Use __detail::__effective_range.
	(path::_S_to_string(InputIterator, InputIterator)): New function
	template to create a string view if possible, or string otherwise.
	(path::_S_convert): Add overloads that convert a string returned
	by __detail::__effective_range. Use if-constexpr to inline conversion
	logic from all overloads of _Cvt::_S_convert.
	(path::_S_convert_loc): Add overload that converts a string. Use
	_S_to_string to avoid allocation when possible.
	(path::_Cvt): Remove.
	(path::operator+=(CharT)): Remove indirection through path::concat.
	* include/experimental/bits/fs_path.h (path::_S_convert_loc): Add
	overload for non-const pointers, to avoid constructing a std::string.
	* src/c++17/fs_path.cc (path::_S_convert_loc): Replace conditional
	compilation with call to _S_convert.
2020-05-23 09:40:16 +01:00
Jonathan Wakely 00c8f2a5e3 libstdc++: Remove incorrect static specifiers
These functions were originally static members of the path class, but
the 'static' specifiers were not removed when they were moved to
namespace scope. This causes ODR violations when the functions are
called from functions defined in the header, which is incompatible with
Nathan's modules branch.  Change them to 'inline' instead.

	* include/bits/fs_path.h (__detail::_S_range_begin)
	(__detail::_S_range_end): Remove unintentional static specifiers.
	* include/experimental/bits/fs_path.h (__detail::_S_range_begin)
	(__detail::_S_range_end): Likewise.
2020-05-23 09:40:16 +01:00
Jonathan Wakely 988b853f9c libstdc++: Simplify filesystem::path SFINAE constraints
This replaces the filesystem::__detail::_Path SFINAE helper with two
separate helpers, _Path and _Path2. This avoids having one helper which
tries to check two different sets of requirements.

The _Path helper now uses variable templates instead of a set of
overloaded functions to detect specializations of basic_string or
basic_string_view.

The __not_<is_void<remove_pointer_t<_Tp1>> check is not necessary in
C++20 because iterator_traits<void*> is now empty. For C++17 replace
that check with a __safe_iterator_traits helper with partial
specializations for void pointers.

Finally, the __is_encoded_char check no longer uses remove_const_t,
which means that iterators with a const value_type will no longer be
accepted as arguments for path creation. Such iterators resulted in
undefined behaviour anyway, so it's still conforming to reject them in
the constraint checks.

	* include/bits/fs_path.h (filesystem::__detail::__is_encoded_char):
	Replace alias template with variable template. Don't remove const.
	(filesystem::__detail::__is_path_src): Replace overloaded function
	template with variable template and specializations.
	(filesystem::__detail::__is_path_iter_src): Replace alias template
	with class template.
	(filesystem::__detail::_Path): Use __is_path_src. Remove support for
	iterator pairs.
	(filesystem::__detail::_Path2): New alias template for checking
	InputIterator requirements.
	(filesystem::__detail::__constructible_from): Remove.
	(filesystem::path): Replace _Path<Iter, Iter> with _Path2<Iter>.
	* testsuite/27_io/filesystem/path/construct/80762.cc: Check with two
	constructor arguments of void and void* types.
2020-05-23 09:40:16 +01:00
Matthias Kretz bc7a4f2f9e libstdc++: Enable simple invocation of runtest in testsuite
2020-05-21  Matthias Kretz  <kretz@kde.org>

	* testsuite/Makefile.am: Remove dup target_triplet and set tool,
	allowing runtest to work without arguments.
	* testsuite/Makefile.in: Regenerate.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
2020-05-21 14:16:19 +01:00
Jonathan Wakely f094665d46 libstdc++: Avoid constraint recursion with iterator_traits (PR 93983)
Checking whether a filesystem::path constructor argument is an iterator
requires instantiating std::iterator_traits. In C++20 that checks for
satisfaction of std::iterator_traits constraints, which checks if the
type is copyable, which can end up recursing back to the path
constructor. The fix in LWG 3420 is to reorder the cpp17-iterator
concept's constraints to check if the type looks vaguely like an
iterator before checking copyable. That avoids the recursion for types
which definitely aren't iterators, but isn't foolproof.

	PR libstdc++/93983
	* include/bits/iterator_concepts.h (__detail::__cpp17_iterator):
	Reorder constraints to avoid recursion when constructors use
	iterator_traits (LWG 3420).
	* testsuite/24_iterators/customization_points/lwg3420.cc: New test.
2020-05-21 07:32:15 +01:00
Jonathan Wakely 0a1baad8eb libstdc++: Use macro for nodiscard attribute
* include/experimental/socket (basic_socket::is_open()
	(basic_socket_acceptor::is_open()): Use _GLIBCXX_NODISCARD macro.
2020-05-21 01:03:27 +01:00
Jonathan Wakely b780db2ea3 libstdc++: Better requirements checking in Networking TS
Define concepts and traits for checking type requirements.

	* include/experimental/bits/net.h (__endpoint, __protocol)
	(__acceptable_protocol, __inet_protocol): New concepts.
	(__detail::__is_endpoint): Move trait from <experimental/socket>.
	(__is_protocol, __is_acceptable_protocol, __is_inet_protocol): New
	traits.
	(__endpoint, __protocol, __acceptable_protocol): New variable
	templates.
	* include/experimental/socket (__is_endpoint): Move to net.h header.
	(basic_socket, basic_socket_acceptor): Check requirements.
2020-05-21 00:59:55 +01:00
Jonathan Wakely d9d34449bb libstdc++: Fix net::basic_socket::close(error_code&)
Also add some missing member functions, nodiscard attributes, and
noexcept-specifiers.

	* include/experimental/executor (use_future_t::use_future_t()): Fix
	incorrect noexcept-specifier.
	* include/experimental/internet (basic_resolver_results): Adjust
	whitespace.
	* include/experimental/socket (__basic_socket_impl::release): Add
	member function.
	(basic_socket(io_context&, const endpoint_type&)): Fix argument to
	target constructor.
	(basic_socket::release(), basic_socket::release(error_code&)): Add
	missing member functions.
	(basic_socket::is_open()): Add nodiscard attribute.
	(basic_socket::close(error_code&)): Pass argument to base function.
	(basic_socket_acceptor::release())
	(basic_socket_acceptor::release(error_code&)): Add missing member
	functions.
	(basic_socket_acceptor::is_open()): Add nodiscard attribute.
	(basic_socket_streambuf::error()): Add noexcept.
	(basic_socket_iostream::error()): Likewise.
	* testsuite/experimental/net/socket/basic_socket.cc: New test.
2020-05-21 00:59:55 +01:00
Jonathan Wakely f26e72d831 libstdc++: Use 'using' for types in Networking TS headers
* include/experimental/buffer: Replace typedefs with
	alias-declarations.
	* include/experimental/executor: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/socket: Likewise.
	* include/experimental/timer: Likewise.
2020-05-21 00:59:55 +01:00
Jonathan Wakely a2d196e75c libstdc++: Use RDRAND as fallback if RDSEED keeps failing (PR 94087)
It's not difficult for multiple threads to drain the entropy available
to the RDSEED instruction, at which point we throw an exception. This
change will try to use RDRAND after RDSEED fails repeatedly, and only
throw if RDRAND also fails repeatedly. This doesn't guarantee a random
value can always be read, but reduces the likelihood of failure when
using the RDSEED instruction.

	PR libstdc++/94087
	* src/c++11/random.cc (__x86_rdseed): Allow fallback function to be
	passed in.
	(__x86_rdseed_rdrand): New function that uses rdseed with rdrand
	fallback.
	(random_device::_M_init): Use __x86_rdseed_rdrand when both
	instructions are available.
	* testsuite/26_numerics/random/random_device/94087.cc: New test.
2020-05-19 23:04:45 +01:00
Patrick Palka 864fed4a49 c++: Explain fn template argument type/value mismatches [PR66439]
In fn_type_unifcation, we are passing NULL_TREE as the 'in_decl'
parameter to coerce_template_parms, and this is causing template
type/value mismatch error messages to get suppressed regardless of the
value of 'complain'.

This means that when substitution into a function template fails due to
a type/value mismatch between a template parameter and the provided
template argument, we just say "template argument deduction/substitution
failed:" without a followup explanation of the failure.

Fix this by passing 'fn' instead of NULL_TREE to coerce_template_parms.

gcc/cp/ChangeLog:

	PR c++/66439
	* pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
	the 'in_decl' parameter to coerce_template_parms.

gcc/testsuite/ChangeLog:

	PR c++/66439
	* g++.dg/cpp2a/concepts-ts4.C: Expect a "type/value mismatch"
	diagnostic.
	* g++.dg/cpp2a/concepts-ts6.C: Likewise.
	* g++.dg/template/error56.C: Likewise.
	* g++.dg/template/error59.C: New test.

libstdc++-v3/ChangeLog:

	PR c++/66439
	* testsuite/20_util/pair/astuple/get_neg.cc: Prune "type/value
	mismatch" messages.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Likewise.
2020-05-18 23:50:14 -04:00
H.J. Lu 4c1a5d8b71 x86: Also check if -fcf-protection works
When defaulting CET run-time support to auto, check if -fcf-protection
works.  Even if the stage1 GCC doesn't support -fcf-protection, since
the final GCC does, CET run-time support will be enabled by default if
binutils support CET.

config/

	PR bootstrap/95147
	* cet.m4 (GCC_CET_FLAGS): Also check if -fcf-protection works
	when defaulting to auto.

libatomic/

	PR bootstrap/95147
	* configure: Regenerated.

libbacktrace/

	PR bootstrap/95147
	* configure: Regenerated.

libgcc/

	PR bootstrap/95147
	* configure: Regenerated.

libgfortran/

	PR bootstrap/95147
	* configure: Regenerated.

libgomp/

	PR bootstrap/95147
	* configure: Regenerated.

libitm/

	PR bootstrap/95147
	* configure: Regenerated.

libobjc/

	PR bootstrap/95147
	* configure: Regenerated.

libphobos/

	PR bootstrap/95147
	* configure: Regenerated.

libquadmath/

	PR bootstrap/95147
	* configure: Regenerated.

libsanitizer/

	PR bootstrap/95147
	* configure: Regenerated.

libssp/

	PR bootstrap/95147
	* configure: Regenerated.

libstdc++-v3/

	PR bootstrap/95147
	* configure: Regenerated.

libvtv/

	PR bootstrap/95147
	* configure: Regenerated.

zlib/

	PR bootstrap/95147
	* configure: Regenerated.
2020-05-15 09:07:17 -07:00
H.J. Lu 8d286dd118 x86: Default CET run-time support to auto
CET has been added since GCC 8.  This patch defaults CET run-time support
to auto.  It enables CET run-time support if asssembler supports CET
instructions and multi-byte NOPs are enabled via SSE2.

config/

	* cet.m4 (GCC_CET_FLAGS): Change default to auto.

gcc/

	* configure: Regenerated.

libatomic/

	* configure: Regenerated.

libbacktrace/

	* configure: Regenerated.

libcc1/

	* configure: Regenerated.

libcpp/

	* configure: Regenerated.

libdecnumber/

	* configure: Regenerated.

libgcc/

	* configure: Regenerated.

libgfortran/

	* configure: Regenerated.

libgomp/

	* configure: Regenerated.

libitm/

	* configure: Regenerated.

libobjc/

	* configure: Regenerated.

libquadmath/

	* configure: Regenerated.

libsanitizer/

	* configure: Regenerated.

libssp/

	* configure: Regenerated.

libstdc++-v3/

	* configure: Regenerated.

libvtv/

	* configure: Regenerated.

zlib/

	* configure: Regenerated.
2020-05-14 09:05:02 -07:00
Alexandre Oliva 883246530f x86-vxworks malloc aligns to 8 bytes like solaris
Vxworks 7's malloc, like Solaris', only ensures 8-byte alignment of
returned pointers on 32-bit x86, though GCC's stddef.h defines
max_align_t with 16-byte alignment for __float128.  This patch enables
on x86-vxworks the same memory_resource workaround used for x86-solaris.

The testsuite also had a workaround, defining BAD_MAX_ALIGN_T and
xfailing the test; extend those to x86-vxworks as well, and remove the
check for char-aligned requested allocation to be aligned like
max_align_t.  With that change, the test passes on x86-vxworks; I'm
guessing that's the same reason for the test not to pass on
x86-solaris (and on x86_64-solaris -m32), so with the fix, I'm
tentatively removing the xfail.


for libstdc++-v3/ChangeLog

	PR libstdc++/77691
	* include/experimental/memory_resource
	(__resource_adaptor_imp::do_allocate): Handle max_align_t on
	x86-vxworks as on x86-solaris.
	(__resource_adaptor_imp::do_deallocate): Likewise.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Drop xfail.
	(BAD_MAX_ALIGN_T): Define on x86-vxworks as on x86-solaris.
	(test03): Drop max-align test for char-aligned alloc.
2020-05-13 04:49:00 -03:00
Ulrich Drepper 491ba663e0 Implent C++20 std::atomic_flag::test
* include/bits/atomic_base.h (atomic_flag): Implement test member
        function.
        * include/std/version: Define __cpp_lib_atomic_flag_test.
        * testsuite/29_atomics/atomic_flag/test/explicit.cc: New file.
        * testsuite/29_atomics/atomic_flag/test/implicit.cc: New file.
2020-05-12 07:37:09 +02:00
François Dumont ffeb6554be Revert "libstdc++ Enhance thread safety of debug mode iterators"
This reverts commit 0b83c4fabb.
2020-05-11 14:07:06 +02:00
François Dumont 0b83c4fabb libstdc++ Enhance thread safety of debug mode iterators
Avoids race condition when checking for an iterator to be singular or
to be comparable to another iterator.

	* src/c++/debug.cc
	(_Safe_sequence_base::_M_attach_single): Set attached iterator
	sequence pointer and version.
	(_Safe_sequence_base::_M_detach_single): Reset detached iterator.
	(_Safe_iterator_base::_M_attach): Remove attached iterator sequence
	pointer and version asignments.
	(_Safe_iterator_base::_M_attach_single): Likewise.
	(_Safe_iterator_base::_M_detach_single): Remove detached iterator
	reset.
	(_Safe_iterator_base::_M_singular): Use atomic load to access parent
	sequence.
	(_Safe_iterator_base::_M_can_compare): Likewise.
	(_Safe_iterator_base::_M_get_mutex): Likewise.
	(_Safe_local_iterator_base::_M_attach): Remove attached iterator container
	pointer and version assignments.
	(_Safe_local_iterator_base::_M_attach_single): Likewise.
	(_Safe_unordered_container_base::_M_attach_local_single):
	Set attached iterator container pointer and version.
	(_Safe_unordered_container_base::_M_detach_local_single): Reset detached
	iterator.
2020-05-10 23:01:41 +02:00
Jonathan Wakely 91d505491c libstdc++: Fix whitespace in Changelog 2020-05-07 21:47:49 +01:00
Jonathan Wakely 9c24e97a97 libstdc++: Fix some C++20 algorithms to work in parallel mode
Some new algorithms need to use _GLIBCXX_STD_A to refer to the "normal"
version of the algorithm, to workaround the namespace dance done for
parallel mode.

	PR libstdc++/94971 (partial)
	* include/bits/ranges_algo.h (ranges::__sample_fn): Qualify
	std::sample using macro to work in parallel mode.
	(__sort_fn): Likewise for std::sort.
	(ranges::__nth_element_fn): Likewise for std::nth_element.
	* include/bits/stl_algobase.h (lexicographical_compare_three_way):
	Likewise for std::__min_cmp.
	* include/parallel/algobase.h (lexicographical_compare_three_way):
	Add to namespace std::__parallel.
2020-05-07 21:43:49 +01:00
Jonathan Wakely 4cbc9d8b34 libstdc++: Make relational operators work with const guarded iterators (PR 92472)
This is a correct fix for the incorrect cppcheck suggestion to make
these parameters const. In order to that, the dereference operators need
to be const. The conversions to the underlying iterator can be const
too.

	PR c/92472
	* include/parallel/multiway_merge.h (_GuardedIterator::operator*)
	(_GuardedIterator::operator _RAIter, _UnguardedIterator::operator*)
	(_UnguardedIterator::operator _RAIter): Add const qualifier.
	(operator<(_GuardedIterator&, _GuardedIterator&)
	(operator<=(_GuardedIterator&, _GuardedIterator&)
	(operator<(_UnguardedIterator&, _UnguardedIterator&)
	(operator<=(_UnguardedIterator&, _UnguardedIterator&): Change
	parameters to const references.
2020-05-07 21:43:49 +01:00
Eric Botcazou 359b19e990 Update the baseline symbols for SPARC64/Linux 2020-05-07 10:56:51 +02:00
François Dumont 72a54e5e81 libstdc++ std::fill overload for std::vector<bool>::iterator
Extend the overload so that it is used even when _GLIBCXX_DEBUG mode
is activated.

	* include/bits/stl_algobase.h (struct _Bit_iterator): New declaration.
	(std::__fill_a1(_Bit_iterator, _Bit_iterator, const bool&)): Likewise.
	* include/bits/stl_bvector.h (__fill_bvector): Move outside
	_GLIBCXX_STD_C namespace.
	(fill(_Bit_iterator, _Bit_iterator, const bool&)): Likewise and rename
	into...
	(__fill_a1): ...this.
	* testsuite/25_algorithms/fill/bvector/1.cc: New.
2020-05-06 23:28:22 +02:00
H.J. Lu a3f1fc0625 x32: Update baseline_symbols.txt
* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Updated.
2020-05-06 06:17:44 -07:00
Rainer Orth 093d95fe34 libstdc++: Update Solaris baselines for GCC 10.1
I just remembered that the libstdc++ ABI baselines haven't been updated
for the GCC 10 release yet.  This patch corrects this for Solaris/SPARC
and x86.

Created on master with make new-abi-baseline on i386-pc-solaris2.11 and
sparc-sun-solaris2.11, bootstrapped on gcc-10 branch without regressions.

	* config/abi/post/i386-solaris/baseline_symbols.txt: Regenerate.
	* config/abi/post/i386-solaris/amd64/baseline_symbols.txt:
	Likewise.
	* config/abi/post/sparc-solaris/baseline_symbols.txt: Likewise.
	* config/abi/post/sparc-solaris/sparcv9/baseline_symbols.txt:
	Likewise.
2020-05-06 14:02:34 +02:00
Martin Liska 6208287fca
Revert "Use const for template argument."
This reverts commit 03f9754665.
2020-05-06 12:09:05 +02:00
Jonathan Wakely 2b6f6aeea1 libstdc++: Document library versioning for 9.[123] and 10.1
* doc/xml/manual/abi.xml (abi.versioning.history): Document library
	versions for GCC 9.[123] and 10.1 releases.
	* doc/html/*: Regenerate.
2020-05-06 10:30:15 +01:00
Jakub Jelinek 19d422201c libstdc++: Update {x86_64,i?86,powerpc64,s390x,aarch64}-linux baselines for GCC 10.1
On Wed, May 06, 2020 at 10:49:13AM +0200, Rainer Orth wrote:
> I just remembered that the libstdc++ ABI baselines haven't been updated
> for the GCC 10 release yet.  This patch corrects this for Solaris/SPARC
> and x86.

Oops, here are the updates from Fedora packages built during the weekend.

2020-05-06  Jakub Jelinek  <jakub@redhat.com>

	* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update.
	* config/abi/post/i386-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/i486-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.
2020-05-06 11:21:28 +02:00
Martin Liska af2311abf8
Add missing ChangeLog entries. 2020-05-05 16:10:13 +02:00
Fangrui Song 1405ed4334 libstdc++: Fix the return type of __cxa_finalize
This should return void according to the Itanium C++ ABI.

2020-05-04  Fangrui Song  <maskray@google.com>

	* libsupc++/cxxabi.h (__cxa_finalize): Fix return type.
2020-05-04 23:07:19 +01:00
Jonathan Wakely ae8a08ff59 libstdc++: Fix broken link to SGI STL FAQ
The previous URL to an entry in the wayback machine now redirects to a
page saying "SGI.com Tech Archive Resources now retired" so use an older
entry from the archive.

	* doc/xml/faq.xml: Use working link for SGI STL FAQ.
	* doc/html/*: Regenerate.
2020-05-04 22:54:25 +01:00
Jonathan Wakely bb27781b64 libstdc++: Fix incorrect size calculation in PMR resource (PR 94906)
Calculating the size of a chunk being returned to the upstream allocator
was done with a 32-bit type, so it wrapped if the chunk was 4GB or
larger.

I don't know how to test this without allocating 4GB, so there's no test
in the testsuite. It has been tested manually with allocations sizes and
alignments exceeding 4GB.

	PR libstdc++/94906
	* src/c++17/memory_resource.cc
	(monotonic_buffer_resource::_Chunk::release): Use size_t for shift
	operands.
2020-05-04 22:47:30 +01:00
Nathan Sidwell e6b31fc717 libstdc++: Avoid negating a size_t [pr 94747]
Although the code here is well formed, it doesn't show intent well.
The reason checkers trigger on this is that it is a cause of real
bugs.  So, negate a ptrdiff_t instead.

	* libsupc++/dyncast.cc (__dynamic_cast): Cast offsetof to
	ptrdiff_t before negation, to show intent more clearly.
2020-05-04 10:08:13 -07:00
Jonathan Wakely ec40967f13 libstdc++: Make pmr::synchronized_pool_resource work without libpthread (PR 94936)
I implicitly assumed that programs using pmr::synchronized_pool_resource
would also be using multiple threads, and so the weak symbols in
gthr-posix.h would be resolved by linking to libpthread. If that isn't
true then it crashes when trying to use pthread_key_create.

This commit makes the pool resource check __gthread_active_p() before
using thread-specific data, and just use a single set of memory pools
when there's only a single thread.

	PR libstdc++/94936
	* src/c++17/memory_resource.cc (synchronized_pool_resource::_TPools):
	Add comment about single-threaded behaviour.
	(synchronized_pool_resource::_TPools::move_nonempty_chunks()): Hoist
	class member access out of loop.
	(synchronized_pool_resource::synchronized_pool_resource())
	(synchronized_pool_resource::~synchronized_pool_resource())
	(synchronized_pool_resource::release()): Check __gthread_active_p
	before creating and/or deleting the thread-specific data key.
	(synchronized_pool_resource::_M_thread_specific_pools()): Adjust
	assertions.
	(synchronized_pool_resource::do_allocate(size_t, size_t)): Add fast
	path for single-threaded case.
	(synchronized_pool_resource::do_deallocate(void*, size_t, size_t)):
	Likewise. Return if unable to find a pool that owns the allocation.
	* testsuite/20_util/synchronized_pool_resource/allocate_single.cc:
	New test.
	* testsuite/20_util/synchronized_pool_resource/cons_single.cc: New
	test.
	* testsuite/20_util/synchronized_pool_resource/release_single.cc: New
	test.
2020-05-04 13:37:31 +01:00
Jonathan Wakely 22b6b5d6cf libstdc++: Make byte-sized std::fill_n a constant expression (PR 94933)
The overload for byte types uses memset and isn't constexpr. This adds
the specifier and uses std::is_constant_evaluated() to provide a
compile-time alternative.

	PR libstdc++/94933
	* include/bits/stl_algobase.h (__fill_a1): Make overload for byte types
	usable in constant expressions.
	* testsuite/25_algorithms/fill_n/constexpr.cc: Test with bytes and
	non-scalars.
2020-05-03 13:33:15 +01:00
Jonathan Wakely 187c854cc6 libstdc++: Add more tests for _E10, _E11 etc. (PR 94901)
PR libstdc++/94901
	* testsuite/17_intro/badnames.cc: Test values between _E9 and _E24 too.
2020-05-01 14:49:48 +01:00
Jonathan Wakely a5f2fb1ff1 libstdc++: Replace deduced return type in ranges::iter_move (PR 92894)
The deduced return type causes the instantiation of the function body,
which can then require the instantiation of std::projected::operator*
which is intentionally not defined.

This patch uses a helper trait to define the return type, so that the
function body doesn't need to be instantiated. That helper trait can
then also be used in other places that currently check the return type
of ranges::iter_move (iter_rvalue_reference_t and indirectly_readable).

2020-05-01  Jonathan Wakely  <jwakely@redhat.com>
	    Patrick Palka  <ppalka@redhat.com>

	PR libstdc++/92894
	* include/bits/iterator_concepts.h (ranges::__cust_imove::_IMove):
	Add trait to determine return type and an alias for it.
	(ranges::__cust_imove::_IMove::operator()): Use __result instead of
	deduced return type.
	(iter_rvalue_reference_t): Use _IMove::__type instead of checking
	the result of ranges::iter_move.
	(__detail::__indirectly_readable_impl): Use iter_rvalue_reference_t
	instead of checking the result of ranges::iter_move.
	* testsuite/24_iterators/customization_points/92894.cc: New test.
	* testsuite/24_iterators/indirect_callable/92894.cc: New test.
2020-05-01 14:27:25 +01:00
Jonathan Wakely 070b4df8a0 libstdc++: Replace reserved identifier _T with _Tp (PR 94901)
The libstdc++ manual documents that _T can not be used, because it's a
macro in system headers on some targets.

	PR libstdc++/94901
	* include/std/type_traits (__is_complete_or_unbounded): Replace
	BADNAME _T with _Tp.
	* testsuite/17_intro/badnames.cc: New test.
2020-05-01 13:41:02 +01:00
Jonathan Wakely b1983f4582 libstdc++: Avoid errors in allocator's noexcept-specifier (PR 89510)
This fixes a regression due to the conditional noexcept-specifier on
std::allocator::construct and std::allocator::destroy, as well as the
corresponding members of new_allocator, malloc_allocator, and
allocator_traits. Those noexcept-specifiers were using expressions which
might be ill-formed, which caused errors outside the immediate context
when checking for the presence of construct and destroy in SFINAE
contexts.

The fix is to use the is_nothrow_constructible and
is_nothrow_destructible type traits instead, because those traits are
safe to use even when the construction/destruction itself is not valid.

The is_nothrow_constructible trait will be false for a type that is not
also nothrow-destructible, even if the new-expression used in the
construct function body is actually noexcept. That's not the correct
answer, but isn't a problem because providing a noexcept-specifier on
these functions is not required by the standard anyway. If the answer is
false when it should be true, that's suboptimal but OK (unlike giving
errors for valid code, or giving a true answer when it should be false).

	PR libstdc++/89510
	* include/bits/alloc_traits.h (allocator_traits::_S_construct)
	(allocator_traits::_S_destroy)
	(allocator_traits<allocator<T>>::construct): Use traits in
	noexcept-specifiers.
	* include/bits/allocator.h (allocator<void>::construct)
	(allocator<void>::destroy): Likewise.
	* include/ext/malloc_allocator.h (malloc_allocator::construct)
	(malloc_allocator::destroy): Likewise.
	* include/ext/new_allocator.h (new_allocator::construct)
	(new_allocator::destroy): Likewise.
	* testsuite/20_util/allocator/89510.cc: New test.
	* testsuite/ext/malloc_allocator/89510.cc: New test.
	* testsuite/ext/new_allocator/89510.cc: New test.
2020-04-30 16:01:43 +01:00
Jonathan Wakely 8f1591763f libstdc++: Fix outdated comment about std::string instantiations (PR 94854)
PR libstdc++/94854
	* include/bits/basic_string.tcc: Update comment about explicit
	instantiations.
2020-04-29 19:00:58 +01:00
Jonathan Wakely d0330a0360 libstdc++: Fixes for feature test macros (PR 91480)
Remove the non-standard __cpp_lib_allocator_is_always_equal macro and
add the missing macros for P1032R1.

	PR libstdc++/91480
	* include/bits/allocator.h (__cpp_lib_allocator_is_always_equal):
	Remove non-standard macro.
	* include/bits/stl_iterator.h (__cpp_lib_constexpr_iterator): Define
	to indicate P1032R1 support.
	* include/bits/stl_pair.h (__cpp_lib_constexpr_utility): Likewise.
	* include/std/string_view (__cpp_lib_constexpr_string_view): Likewise.
	* include/std/tuple (__cpp_lib_constexpr_tuple): Likewise.
	* include/std/version (__cpp_lib_allocator_is_always_equal): Remove.
	(__cpp_lib_constexpr_iterator, __cpp_lib_constexpr_string_view)
	(__cpp_lib_constexpr_tuple, __cpp_lib_constexpr_utility): Define.
	* testsuite/20_util/function_objects/constexpr_searcher.cc: Check
	feature test macro.
	* testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc: Likewise.
	* testsuite/21_strings/basic_string_view/operations/copy/char/
	constexpr.cc: Likewise.
	* testsuite/24_iterators/insert_iterator/constexpr.cc: Likewise.
2020-04-28 23:40:18 +01:00
Jonathan Wakely 162c40a4c1 libstdc++: Fix regression in std::_Construct (PR 94831)
By trying to reuse the existing std::_Construct function as a wrapper
for std::construct_at I introduced regressions, because changing
std::_Construct to return non-void made it ill-formed for array types.

The solution is to revert _Construct to its former state, and change
allocator_traits::construct to explicitly call construct_at instead.
This decouples all the existing callers of _Construct from the new
construct_at requirements.

	PR libstdc++/94831
	* include/bits/alloc_traits.h (_S_construct): Restore placement
	new-expression for C++11/14/17 and call std::construct_at directly
	for C++20.
	* include/bits/stl_construct.h (_Construct): Revert to non-constexpr
	function returning void.
	* testsuite/20_util/specialized_algorithms/
	uninitialized_value_construct/94831.cc: New test.
	* testsuite/23_containers/vector/cons/94831.cc: New test.
2020-04-28 23:39:38 +01:00
Patrick Palka 19667c82e4 libstdc++: Fix subrange::advance and subrange::prev (LWG 3433)
This implements the proposed resolution of LWG 3433, which fixes
subrange::advance when called with a negative argument.

libstdc++-v3/ChangeLog:

	LWG 3433 subrange::advance(n) has UB when n < 0
	* include/std/ranges (subrange::prev): Fix typo.
	(subrange::advance): Handle a negative argument as per the proposed
	resolution of LWG 3433.
	* testsuite/std/ranges/subrange/lwg3433.cc: New test.
2020-04-28 16:43:23 -04:00
Iain Sandoe b9c91b7f32 coroutines: Fix handling of non-class coroutine returns [PR94759]
From the standard:

The header <coroutine> defines the primary template coroutine_traits
such that if ArgTypes is a parameter pack of types and if the
qualified-id R::promise_type is valid and denotes a type, then
coroutine_traits<R,ArgTypes...> has the following publicly accessible
member:
     using promise_type = typename R::promise_type;

this should not prevent more specialised cases and  the following
code should be accepted, but is currently rejected with:

'error: coroutine return type ‘void’ is not a class'

This is because the check for non-class-ness of the return value was
in the wrong place; it needs to be carried out in a SFINAE context.

The following patch removes the restriction in the traits template
instantiation and allows for the case that the ramp function could
return void.

The <coroutine> header is amended to implement the required
functionality.

gcc/cp/ChangeLog:

2020-04-28  Iain Sandoe  <iain@sandoe.co.uk>

	PR c++/94759
	* coroutines.cc (coro_promise_type_found_p): Do not
	exclude non-classes here (this needs to be handled in the
	coroutine header).
	(morph_fn_to_coro):  Allow for the case where the coroutine
	returns void.

gcc/testsuite/ChangeLog:

2020-04-28  Iain Sandoe  <iain@sandoe.co.uk>

	PR c++/94759
	* g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C: Adjust for
	updated error messages.
	* g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C: Likewise.
	* g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C: Likewise.
	* g++.dg/coroutines/coro-missing-promise.C: Likewise.
	* g++.dg/coroutines/pr93458-5-bad-coro-type.C: Liekwise.
	* g++.dg/coroutines/torture/co-ret-17-void-ret-coro.C: New test.

libstdc++-v3/ChangeLog:

2020-04-28  Jonathan Wakely  <jwakely@redhat.com>
	    Iain Sandoe  <iain@sandoe.co.uk>

	PR c++/94759
	* include/std/coroutine: Implement handing for non-
	class coroutine return types.
2020-04-28 02:07:37 +01:00
Jonathan Wakely 00082ff88c libstdc++: Make net::service_already_exists default constructible
The LWG issue I created is Tentatively Ready and proposes to declare a
public default constructor, rather than the private one I added
recently.

	* include/experimental/executor (service_already_exists): Make default
	constructor public (LWG 3414).
	* testsuite/experimental/net/execution_context/make_service.cc: Check
	the service_already_exists can be default constructed.
2020-04-24 14:15:51 +01:00
Jonathan Wakely d1462b0782 libstdc++: Fix constructor constraints for std::any (PR 90415)
This removes a non-standard extension to std::any which causes errors
for valid code, due to recursive instantiation of a trait that isn't
supposed to be in the constraints.

It also removes some incorrect constraints on the in_place_type<T>
constructors and emplace members, which were preventing creating a
std::any object with another std::any as the contained value.

2020-04-24  Kamlesh Kumar  <kamleshbhalui@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/90415
	PR libstdc++/92156
	* include/std/any (any): Rename template parameters for consistency
	with the standard.
	(any::_Decay): Rename to _Decay_if_not_any.
	(any::any(T&&):: Remove is_constructible from constraints. Remove
	non-standard overload.
	(any::any(in_place_type_t<T>, Args&&...))
	(any::any(in_place_type_t<T>, initializer_list<U>, Args&&...))
	(any::emplace(Args&&...))
	(any::emplace(initializer_list<U>, Args&&...)):
	Use decay_t instead of _Decay.
	* testsuite/20_util/any/cons/90415.cc: New test.
	* testsuite/20_util/any/cons/92156.cc: New Test.
	* testsuite/20_util/any/misc/any_cast_neg.cc: Make dg-error directives
	more robust.
	* testsuite/20_util/any/modifiers/92156.cc: New test.
2020-04-24 00:54:20 +01:00
Thomas Rodgers 8c9d69bafc libstdc++: Mark experimental::net::system_context ctor deleted
* include/experimental/net/executor (system_context): Mark
           system_context::system_context() = delete.
           * testsuite/experimental/net/executor/1.cc: Add new
           test to check system_context is not default constructible.
2020-04-23 13:44:23 -07:00
Jonathan Wakely be0363c80f libstdc++: Update C++20 library status docs
This reorganises the C++20 status table, grouping the proposals by
category. It also adds more proposals, and documents all the feature
test macros for C++20 library changes.

	* doc/xml/manual/status_cxx2020.xml: Update C++20 status table.
	* doc/html/*: Regenerate.
2020-04-23 21:39:33 +01:00
Jonathan Wakely 40541efe1c libstdc++: Change __cpp_lib_array_constexpr for C++17 again
This partially reverts my previous change related to this macro. The
C++20 constexpr iterator requirements are always met by array:iterator,
because it's just a pointer. So the macro can be set to 201803 even in
C++17 mode.

	* include/bits/stl_iterator.h (__cpp_lib_array_constexpr): Revert
	value for C++17 to 201803L because P0858R0 is supported for C++17.
	* include/std/version (__cpp_lib_array_constexpr): Likewise.
	* testsuite/23_containers/array/element_access/constexpr_c++17.cc:
	Check for value corresponding to P0031R0 features being tested.
	* testsuite/23_containers/array/requirements/constexpr_iter.cc:
	Check for value corresponding to P0858R0 features being tested.
2020-04-23 21:39:33 +01:00
Jonathan Wakely a2dcb56c94 libstdc++: Define __cpp_lib_three_way_comparison for freestanding
The <compare> header is always supported, not only for hosted configs.

	* include/std/version (__cpp_lib_three_way_comparison): Define for
	freestanding builds.
2020-04-23 21:39:33 +01:00
Iain Sandoe dcf69ac544 coroutines, libstdc++-v3: Update to n4861 C++20 DIS.
Update the inline namespace to __n4861.
Add '__cpp_lib_coroutine' defined to 201902L per n4861.

libstdc++-v3/ChangeLog:

2020-04-23  Iain Sandoe  <iain@sandoe.co.uk>

	* include/std/coroutine: Update the inline namespace to __n4861.
	Add the __cpp_lib_coroutine define, set to 201902L.
	* include/std/version: Add __cpp_lib_coroutine, set to 201902L.

gcc/testsuite/ChangeLog:

2020-04-23  Iain Sandoe  <iain@sandoe.co.uk>

	* g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C: Adjust for
	changed inline namespace.
	* g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C: Likewise.
	* g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C: Likewise
	* g++.dg/coroutines/coro.h: Likewise
2020-04-23 16:27:29 +01:00
Jonathan Wakely aac39307e8 libstdc++: Define __cpp_lib_execution feature test macro
This macro has never been defined by libstdc++, despite supporting the
parallel algorithms. It should have a different value for C++17 and
C++20, because P1001R2 should not be supported in C++17, but
unsequenced_policy is defined for C++17 (see PR p4702).

	* include/std/execution (__cpp_lib_execution): Define to indicate
	support for P0024R2 and P1001R2.
	* include/std/version (__cpp_lib_execution): Define.
	* testsuite/25_algorithms/pstl/feature_test.cc: Only test macro
	defined by <algorithm>, move other tests to new tests ...
	* testsuite/25_algorithms/pstl/feature_test-2.cc: New test.
	* testsuite/25_algorithms/pstl/feature_test-3.cc: New test.
	* testsuite/25_algorithms/pstl/feature_test-4.cc: New test.
	* testsuite/25_algorithms/pstl/feature_test-5.cc: New test.
2020-04-22 22:54:35 +01:00
Jonathan Wakely e851aa1703 libstdc++: Update (and revert) value of __cpp_lib_array_constexpr
This macro should have been updated to 201811 when the last C++20
changes were implemented. However those changes are not enabled for
C++17 mode, so the macro should only have the new value in C++20 mode.

This change ensures that the macro is defined to 201603 for C++17 and
201811 for C++20.

	* include/bits/stl_iterator.h (__cpp_lib_array_constexpr): Define
	different values for C++17 and C++20, to indicate different feature
	sets. Update value for C++20 to indicate P1032R1 support.
	* include/std/version (__cpp_lib_array_constexpr): Likewise.
	* testsuite/23_containers/array/comparison_operators/constexpr.cc:
	Check feature test macro.
	* testsuite/23_containers/array/element_access/constexpr_c++17.cc:
	New test.
	* testsuite/23_containers/array/requirements/constexpr_fill.cc: Check
	feature test macro.
	* testsuite/23_containers/array/requirements/constexpr_iter.cc: Test
	in C++17 mode and check feature test macro.
2020-04-22 22:54:35 +01:00
Jonathan Wakely 2025db692e libstdc++: Do not define __cpp_lib_constexpr_algorithms in <utility>
The C++20 draft and SD-6 both say this should only be in <version> and
<algorithm>, not in <utility>.

	* include/std/utility (__cpp_lib_constexpr_algorithms): Do not define
	here.
	* testsuite/20_util/exchange/constexpr.cc: Do not expect macro to be
	defined by <utility>.
2020-04-22 22:54:35 +01:00
Jonathan Wakely c9313582d8 libstdc++: Update __cpp_lib_concepts value
* include/std/functional (__cpp_lib_concepts): Update macro value to
	indicate P1964R2 support.
	* include/std/version (__cpp_lib_concepts): Likewise.
	* testsuite/std/concepts/1.cc: Adjust expected value.
	* testsuite/std/concepts/2.cc: Likewise.
2020-04-22 22:54:34 +01:00
Jonathan Wakely eca477d16c libstdc++: Rename __cpp_lib_constexpr_invoke macro
This macro was renamed after it was added to the working draft, but we
never renamed it  in libstdc++. We haven't made a release with the old
macro name, so I see no need to keep it around.

	* include/std/functional (__cpp_lib_constexpr_invoke): Rename to
	__cpp_lib_constexpr_functional.
	* include/std/version (__cpp_lib_constexpr_invoke): Likewise.
	* testsuite/20_util/function_objects/invoke/constexpr.cc: Adjust.
2020-04-22 22:54:34 +01:00
Jonathan Wakely 56772f623e libstdc++: Add missing feature test macros
These macros all correspond to features that are already supported, but
the macro was not defined when the feature was implemented.

	* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define to
	indicate P1006R1 support.
	(__cpp_lib_to_address): Define to indicate P0653R2 support.
	* include/bits/range_access.h (__cpp_lib_ssize): Define to indicate
	P1227R2 support.
	* include/bits/ranges_algo.h (__cpp_lib_shift): Define to indicate
	P0769R2 support.
	* include/std/atomic (__cpp_lib_atomic_float): Define to indicate
	P0020R6 support.
	* include/std/memory (__cpp_lib_assume_aligned): Define to indicate
	P1007R3 support.
	* include/std/memory_resource (__cpp_lib_polymorphic_allocator):
	Define to indicate P0339R6 support.
	* include/std/string_view (__cpp_lib_starts_ends_with): Define to
	indicate P0457R2 support.
	* include/std/type_traits (__cpp_lib_is_nothrow_convertible): Define
	to indicate P0758R1 support.
	(__cpp_lib_remove_cvref): Define to indicate P0550R2 support.
	(__cpp_lib_type_identity): Define to indicate P0887R1 support.
	* include/std/version (__cpp_lib_atomic_float)
	(__cpp_lib_is_nothrow_convertible, __cpp_lib_remove_cvref)
	(__cpp_lib_type_identity, __cpp_lib_assume_aligned)
	(__cpp_lib_constexpr_memory, __cpp_lib_polymorphic_allocator)
	(__cpp_lib_shift, __cpp_lib_ssize, __cpp_lib_starts_ends_with)
	(__cpp_lib_to_address): Define.
	* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line number.
2020-04-22 22:54:34 +01:00
Jonathan Wakely 0d2dbae406 libstdc++: Remove non-standard feature test macros
These macros were replaced by __cpp_lib_map_try_emplace and
__cpp_lib_unordered_map_try_emplace, because those names are more
descriptive. We've kept both old and new names so far, but I think we
can remove the old ones now.

	* include/bits/stl_map.h (__cpp_lib_map_insertion): Remove old
	macro.
	* include/bits/unordered_map.h (__cpp_lib_unordered_map_insertion):
	Likewise.
	* include/std/version (__cpp_lib_map_insertion)
	(__cpp_lib_unordered_map_insertion): Remove.
2020-04-22 22:54:34 +01:00
Jonathan Wakely aa12ab2e93 libstdc++: Update value of __cpp_lib_jthread macro
* include/std/condition_variable (__cpp_lib_jthread): Remove
	redundant definition.
	* include/std/stop_token (__cpp_lib_jthread): Update macro value to
	indicate P1869R1 support.
	* include/std/version (__cpp_lib_jthread): Update value.
	* testsuite/30_threads/condition_variable_any/stop_token/1.cc: Check
	for updated macro value.
	* testsuite/30_threads/condition_variable_any/stop_token/2.cc:
	Likewise.
	* testsuite/30_threads/jthread/1.cc: Likewise.
	* testsuite/30_threads/jthread/2.cc: Likewise.
	* testsuite/30_threads/stop_token/1.cc: Likewise.
	* testsuite/30_threads/stop_token/2.cc: Likewise.
2020-04-22 22:54:34 +01:00
Jonathan Wakely 0fe9eaaa08 libstdc++: Improve tests for __cpp_lib_erase_if macro
* testsuite/21_strings/basic_string/erasure.cc: Check for updated
	value of __cpp_lib_erase_if.
	* testsuite/23_containers/deque/erasure.cc: Likewise.
	* testsuite/23_containers/forward_list/erasure.cc: Likewise.
	* testsuite/23_containers/list/erasure.cc: Likewise.
	* testsuite/23_containers/map/erasure.cc: Likewise.
	* testsuite/23_containers/set/erasure.cc: Likewise.
	* testsuite/23_containers/unordered_map/erasure.cc: Likewise.
	* testsuite/23_containers/unordered_set/erasure.cc: Likewise.
	* testsuite/23_containers/vector/erasure.cc: Likewise.
2020-04-22 07:25:02 +01:00
Jonathan Wakely 87841658d4 libstdc++: Fix __normal_iterator comparisons for C++20
This fixes a regression introduced when I replaced __normal_iterator's
relational operators with operator<=>. If the wrapped iterator type
doesn't define operator<=> then __normal_iterator doesdn't either, which
breaks any use of fancy pointers that don't define <=>. The regression
was found when trying to build cmcstl2.

The solution is to use synth-three-way to define __normal_iterator's
spaceship operator, so that it is still defined even if the wrapped type
only supports operator<.

	* include/bits/stl_iterator.h (__normal_iterator): Use synth-three-way
	to define operator<=>.
	* testsuite/24_iterators/normal_iterator/cmp_c++20.cc: New test.
2020-04-21 23:46:54 +01:00
Jonathan Wakely 57ede05c6a libstdc++: Improve C++14 and C++17 status docs
This adds a full table of contents for the C++14 and C++17 standards,
with status for each part.

For C++14 the list of proposals is removed, as it adds little value now
that everything is supported. For C++17 the table of proposals is
retained, because it documents he feature test macros for the features.

	* doc/Makefile.am (xml_sources_manual): Add missing XML files.
	* doc/Makefile.in: Regenerate.
	* doc/xml/manual/status_cxx1998.xml: Refer to "this section" instead
	of "this page".
	* doc/xml/manual/status_cxx2011.xml: Formatting and other corrections
	to the C++11 status table.
	* doc/xml/manual/status_cxx2014.xml: Replace list of C++14 feature
	proposals with table matching contents of the C++14 standard.
	* doc/xml/manual/status_cxx2017.xml: Add table matching contents of
	the C++17 standard.
	* doc/html/*: Regenerate.
2020-04-21 22:18:51 +01:00
Jonathan Wakely d76925e46f libstdc++: Support arrays in std::is_nothrow_constructible (PR 94149)
The front end now supports parenthesized initialization for arrays in
C++20, so extend std::is_nothrow_constructible to support them too.

gcc/testsuite:

	PR c++/94149
	* g++.dg/cpp2a/paren-init24.C: Fix FIXMEs.

libstdc++-v3:

	PR c++/94149
	* include/std/type_traits (__is_nt_constructible_impl): Add partial
	specializations for bounded arrays with non-empty initializers.
	* testsuite/20_util/is_nothrow_constructible/value_c++20.cc: New test.
2020-04-21 22:18:51 +01:00
Thomas Rodgers b90ff7a20b libstdc++: Fix PSTL tests to run correctly with newer Thread Building Blocks
* testsuite/lib/libstdc++.exp: Add additional_flags=
	-DTBB_SUPRESS_DEPRECATED_MESSAGES=1 to suppress warnings when
	compiling with a newer Thread Building Blocks.
2020-04-21 01:05:13 -07:00
Jonathan Wakely 86119f1417 libstdc++: Add test for using istreambuf_iterator with sentinel
This test was supposed to be added two months ago as part of commit
120e873484 but was omitted by mistake.

	* testsuite/24_iterators/istreambuf_iterator/sentinel.cc: New test.
2020-04-20 22:06:32 +01:00
Jonathan Wakely 0ea89b1578 libstdc++: Fix tests that fail in C++20 mode
* testsuite/20_util/is_constructible/51185.cc: Make test class a
	non-aggregate so that the test verifies the same thing in all -std
	modes.
	* testsuite/20_util/is_constructible/value-2.cc: Adjust expected
	results for some types when paren-init for aggregates is supported.
2020-04-20 22:06:32 +01:00
Jonathan Wakely b0146791f0 libstdc++: Correct changelog of previous commit
After committing it I noticed I'd also accidentally added a change to
__synth3way as well, which I meant to do in a separate commit. I've
updated the changelog entry to reflect that additional change.

	* libsupc++/compare (__detail::__synth3way): Add noexcept-specifier.
2020-04-20 17:54:50 +01:00
Jonathan Wakely 73a0a21d22 libstdc++: Update __cpp_lib_three_way_comparison macro
With P1614R2 fully implemented (except for the <chrono> types which we
don't support at all) we can define the feature test macro to the new
value.

	* include/std/version (__cpp_lib_three_way_comparison): Update value.
	* libsupc++/compare (__cpp_lib_three_way_comparison): Likewise.
2020-04-20 17:50:10 +01:00
Jonathan Wakely 93843da697 libstdc++: Add comparison operators to associative containers
The last C++20 changes from P1614R2, "The Mothership has Landed"

	* include/bits/stl_map.h (map): Define operator<=> and remove
	operator< for C++20.
	* include/bits/stl_multimap.h (multimap): Likewise.
	* include/bits/stl_multiset.h (multiset): Likewise.
	* include/bits/stl_set.h (set): Likewise.
	* include/bits/stl_tree.h (_Rb_tree): Likewise.
	(_Rb_tree_iterator, _Rb_tree_const_iterator): Remove redundant
	operator!= for C++20.
	* include/debug/map.h (__gnu_debug::map): Define operator<=> for C++20.
	* include/debug/multimap.h (__gnu_debug::multimap): Likewise.
	* include/debug/multiset.h (__gnu_debug::multiset): Likewise.
	* include/debug/set.h (__gnu_debug::set): Likewise.
	* testsuite/23_containers/map/operators/cmp_c++20.cc: New test.
	* testsuite/23_containers/multimap/operators/cmp_c++20.cc: New test.
	* testsuite/23_containers/multiset/operators/cmp_c++20.cc: New test.
	* testsuite/23_containers/set/operators/cmp_c++20.cc: New test.
2020-04-20 17:50:10 +01:00
Matthias Kretz 697b94cfae libstdc++: Avoid illegal argument to verbose in dg-test callback
If extra_tool_flags starts with a dash, an error like 'ERROR: verbose:
illegal argument: -march=native -O2 -std=c++17' is printed. This is
easily fixed by inserting a double dash before the variable.

2020-04-20  Matthias Kretz  <kretz@kde.org>

	* testsuite/lib/libstdc++.exp: Avoid illegal argument to verbose.
2020-04-20 15:29:44 +01:00
Jonathan Wakely 717e91dbc4 libstdc++: Define operator<=> for std::stack and std::queue
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/bits/stl_queue.h (queue): Define operator<=> for C++20.
	* include/bits/stl_stack.h (stack): Likewise.
	* testsuite/23_containers/queue/cmp_c++20.cc: New test.
	* testsuite/23_containers/stack/cmp_c++20.cc: New test.
2020-04-19 21:30:15 +01:00
Jonathan Wakely 7ab9c2430f libstdc++: Remove operator!= overloads for unordered containers
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/bits/unordered_map.h (unordered_map, unordered_multimap):
	Remove redundant operator!= for C++20.
	* include/bits/unordered_set.h (unordered_set, unordered_multiset):
	Likewise.
	* include/debug/unordered_map (unordered_map, unordered_multimap):
	Likewise.
	* include/debug/unordered_set (unordered_set, unordered_multiset):
	Likewise.
2020-04-19 21:05:32 +01:00
Jonathan Wakely a2c0fa35d0 libstdc++: Fix redundant assignment (PR 94629)
This appears to be a copy&paste error, which cppcheck diagnoses.

	PR other/94629
	* include/debug/formatter.h (_Error_formatter::_Parameter): Fix
	redundant assignment in constructor.
2020-04-19 21:05:32 +01:00
Jonathan Wakely 27c171775a libstdc++: Add comparison operators to <chrono> types
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/std/chrono (duration, time_point): Define operator<=> and
	remove redundant operator!= for C++20.
	* testsuite/20_util/duration/comparison_operators/three_way.cc: New
	test.
	* testsuite/20_util/time_point/comparison_operators/three_way.cc: New
	test.
2020-04-18 00:47:45 +01:00
Jonathan Wakely c996029406 libstdc++: Fix testsuite utility's use of allocators
In C++20 the rebind and const_reference members of std::allocator are
gone, so this testsuite utility stopped working, causing
ext/pb_ds/regression/priority_queue_rand_debug.cc to FAIL.

	* testsuite/util/native_type/native_priority_queue.hpp: Use
	allocator_traits to rebind allocator.
2020-04-18 00:12:26 +01:00
Jonathan Wakely bd2420f8fa libstdc++: Add comparison operators to sequence containers
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This implements <=> for sequence containers (and the __normal_iterator
and _Pointer_adapter class templates).

	* include/bits/forward_list.h (forward_list): Define operator<=> and
	remove redundant comparison operators for C++20.
	* include/bits/stl_bvector.h (vector<bool, Alloc>): Likewise.
	* include/bits/stl_deque.h (deque): Likewise.
	* include/bits/stl_iterator.h (__normal_iterator): Likewise.
	* include/bits/stl_list.h (list): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.
	* include/debug/deque (__gnu_debug::deque): Likewise.
	* include/debug/forward_list (__gnu_debug::forward_list): Likewise.
	* include/debug/list (__gnu_debug::list): Likewise.
	* include/debug/safe_iterator.h (__gnu_debug::_Safe_iterator):
	Likewise.
	* include/debug/vector (__gnu_debug::vector): Likewise.
	* include/ext/pointer.h (__gnu_cxx::_Pointer_adapter): Define
	operator<=> for C++20.
	* testsuite/23_containers/deque/operators/cmp_c++20.cc: New test.
	* testsuite/23_containers/forward_list/cmp_c++20.cc: New test.
	* testsuite/23_containers/list/cmp_c++20.cc: New test.
	* testsuite/23_containers/vector/bool/cmp_c++20.cc: New test.
	* testsuite/23_containers/vector/cmp_c++20.cc: New test.
2020-04-17 23:41:04 +01:00
Jonathan Wakely 875d6cb3b4 libstdc++: Add comparison operators for string and regex types
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This adds three-way comparison support to std::char_traits,
std::basic_string, std::basic_string_view, and std::sub_match.

	* include/bits/basic_string.h (basic_string): Define operator<=> and
	remove redundant comparison operators for C++20.
	* include/bits/char_traits.h (__gnu_cxx::char_traits, char_traits):
	Add comparison_category members.
	(__detail::__char_traits_cmp_cat): New helper to get comparison
	category from char traits class.
	* include/bits/regex.h (regex_traits::_RegexMask::operator!=): Do not
	define for C++20.
	(sub_match): Define operator<=> and remove redundant comparison
	operators for C++20.
	(match_results): Remove redundant operator!= for C++20.
	* include/std/string_view (basic_string_view): Define operator<=> and
	remove redundant comparison operators for C++20.
	* testsuite/21_strings/basic_string/operators/char/cmp_c++20.cc: New
	test.
	* testsuite/21_strings/basic_string/operators/wchar_t/cmp_c++20.cc:
	New test.
	* testsuite/21_strings/basic_string_view/operations/copy/char/
	constexpr.cc: Initialize variable.
	* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/
	constexpr.cc: Likewise.
	* testsuite/21_strings/basic_string_view/operators/char/2.cc: Add
	dg-do directive and remove comments showing incorrect signatures.
	* testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operators/char/cmp_c++20.cc:
	New test.
	* testsuite/21_strings/basic_string_view/operators/wchar_t/cmp_c++20.cc:
	New test.
	* testsuite/28_regex/sub_match/compare_c++20.cc: New test.
2020-04-17 16:40:11 +01:00
Jonathan Wakely c8d88bf26e libstdc++: Fix -Wunused-parameter warning in test
* testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Remove
	name of unused parameter.
2020-04-16 08:44:10 +01:00
Jonathan Wakely d43919bf88 libstdc++: Add comparison operators to std::filesystem types
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/bits/fs_dir.h (file_status): Define operator== for C++20.
	(directory_entry): Define operator<=> and remove redundant comparison
	operators for C++20.
	* include/bits/fs_fwd.h (space_info): Define operator== for C++20.
	* include/bits/fs_path.h (path): Define operator<=> and remove
	redundant comparison operators for C++20.
	* testsuite/27_io/filesystem/path/compare/compare.cc: Fix comment.
	* testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/strings.cc: Likewise.
2020-04-15 21:01:42 +01:00
Jonathan Wakely 596676d66c libstdc++: Add comparison operators to types from Utilities clause
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This removes all redundant equality and inequality operators in the
Utilities clause, as they can be synthesized from the remaining equality
operators.

It also removes the single redundant operator in the Localization
clause, because it didn't seem worth doing in a separate commit.

	* include/bits/allocator.h (operator!=): Do not define for C++20.
	* include/bits/locale_classes.h (operator!=): Likewise.
	* include/bits/std_function.h (operator==(nullptr_t, const function&))
	(operator!=(const function&, nullptr_t))
	(operator!=(nullptr_t, const function&)): Likewise.
	* include/ext/bitmap_allocator.h (operator!=): Likewise.
	* include/ext/debug_allocator.h (operator!=): Likewise.
	* include/ext/extptr_allocator.h (operator!=): Likewise.
	* include/ext/malloc_allocator.h (operator!=): Likewise.
	* include/ext/mt_allocator.h (operator!=): Likewise.
	* include/ext/new_allocator.h (operator!=): Likewise.
	* include/ext/pool_allocator.h (operator!=): Likewise.
	* include/ext/throw_allocator.h (operator!=): Likewise.
	* include/std/bitset (bitset::operator!=): Likewise.
	* include/std/memory_resource (operator!=): Likewise.
	* include/std/scoped_allocator (operator!=): Likewise.
2020-04-15 19:47:48 +01:00
Jonathan Wakely 4714fd14af libstdc++: Add spaceship operator to std::type_index
Another C++20 change from P1614R2, "The Mothership has Landed".

	* include/std/typeindex (operator<=>): Define for C++20.
	* testsuite/20_util/typeindex/comparison_operators_c++20.cc: New test.
2020-04-15 19:47:47 +01:00
Jonathan Wakely e1e9e8d7aa libstdc++: Fix constraints on std::compare_three_way
My "simplification" of std::compare_three_way's constraints in commit
f214ffb336 was incorrect, because
std::three_way_comparable_with imposes additional restrictions beyond
the <=> expression being valid.

	* libsupc++/compare (compare_three_way): Fix constraint so that
	BUILTIN-PTR-THREE-WAY does not require three_way_comparable_with.
	* testsuite/18_support/comparisons/object/builtin-ptr-three-way.cc:
	New test.
2020-04-14 21:59:15 +01:00
Jonathan Wakely f5fa62ed19 libstdc++: Add comparison operators to std::shared_ptr (PR 94562)
This also implements the proposed resolution to LWG issue 3247, so that
the ill-formed <=> expression with nullptr is not used.

	PR libstdc++/94562
	* include/bits/shared_ptr.h (operator<=>): Define for C++20.
	* include/bits/shared_ptr_base.h (operator<=>): Likewise.
	* include/bits/unique_ptr.h (operator<=>): Add inline specifier.
	* testsuite/20_util/shared_ptr/comparison/cmp_c++20.cc: New test.
	* testsuite/20_util/shared_ptr/comparison/less.cc: Do not expect
	std::less<A*> to be used when comparing std::shared_ptr<A> objects in
	C++20.
2020-04-14 21:54:55 +01:00
Jonathan Wakely fa9a57ed91 libstdc++: Fix order of entries in ChangeLog 2020-04-14 20:42:48 +01:00
Jonathan Wakely 597601aa7a libstdc++: Make comparison category comparisons noexcept (PR 94565)
PR libstdc++/94565
	* libsupc++/compare (__unspec): Add noexcept-specifier to constructor.
	* testsuite/18_support/comparisons/categories/94565.cc: New test.
2020-04-14 11:42:04 +01:00
Iain Sandoe ee26baf4a8 coroutines: Rename the coroutines cpp builtin.
The current standard draft (n4861) amends the cpp builtin for
coroutines to '__cpp_impl_coroutine', no other change.

gcc/c-family/ChangeLog:

2020-04-13  Iain Sandoe  <iain@sandoe.co.uk>

	* c-cppbuiltin.c (c_cpp_builtins): Update coroutines builtin
	define, per n4861.

gcc/testsuite/ChangeLog:

2020-04-13  Iain Sandoe  <iain@sandoe.co.uk>

	* g++.dg/coroutines/coro-pre-proc.C: Update coroutines builtin
	define, per n4861.
	* g++.dg/coroutines/coro.h: Likewise.

libstdc++-v3/ChangeLog:

2020-04-13  Iain Sandoe  <iain@sandoe.co.uk>

	* include/std/coroutine: Update coroutines builtin define,
	per n4861.
2020-04-13 20:52:03 +01:00
Jonathan Wakely 3fd1c229ad libstdc++: Implement LWG 3324 for [cmp.alg] function objects (LWG 3324)
LWG 3324 changed the [cmp.alg] types to use std::compare_three_way
instead of the <=> operator, but we were still using the old
specification. In order to make the existing tests pass the N::X type
needs to be equality comparable, so that three_way_comparable is
satisfied and compare_three_way can be used.

As part of this change I noticed that the compare_three_way call
operator was unconditionally noexcept, which is incorrect.

	* libsupc++/compare (compare_three_way): Fix noexcept-specifier.
	(strong_order, weak_order, partial_order): Replace uses of <=> with
	compare_three_way function object (LWG 3324).
	* testsuite/18_support/comparisons/algorithms/partial_order.cc: Add
	equality operator so that X satisfies three_way_comparable.
	* testsuite/18_support/comparisons/algorithms/strong_order.cc:
	Likewise.
	* testsuite/18_support/comparisons/algorithms/weak_order.cc: Likewise.
2020-04-09 22:24:57 +01:00
Jonathan Wakely 5b074864f8 libstdc++: Add comparison operators to std::unique_ptr
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This includes the proposed resolution for LWG 3426 to fix the three-way
comparison with nullptr_t.

The existing tests for unique_ptr comparisons don't actually check the
results, only that the expressions compile and are convertible to bool.
This also adds a test for the results of those comparisons for C++11 and
up.

	* include/bits/unique_ptr.h (operator<=>): Define for C++20.
	* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
	* testsuite/20_util/default_delete/void_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/comparison/compare.cc: New test.
	* testsuite/20_util/unique_ptr/comparison/compare_c++20.cc: New test.
2020-04-09 21:10:32 +01:00
Jonathan Wakely ef389dadd4 libstdc++: Add comparison operators to types from Numerics clause
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/bits/slice_array.h (operator==(const slice&, const slice&)):
	Define for C++20.
	* include/std/complex (operator==(const T&, const complex<T>&))
	(operator!=(const complex<T>&, const complex<T>&))
	(operator!=(const complex<T>&, const T&))
	(operator!=(const T&, const complex<T>&)): Do not declare for C++20.
	* testsuite/26_numerics/slice/compare.cc: New test.
2020-04-08 16:51:59 +01:00
Jonathan Wakely e18cd376e0 libstdc++: Add comparison operators to <charconv> result types
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/std/charconv (to_chars_result, from_chars_result): Add
	defaulted equality comparisons for C++20.
	* testsuite/20_util/from_chars/compare.cc: New test.
	* testsuite/20_util/to_chars/compare.cc: New test.
2020-04-08 16:16:10 +01:00
Jonathan Wakely c104e8f1b6 libstdc++: Restore ability to use <charconv> in C++14 (PR 94520)
This C++17 header is supported in C++14 as a GNU extension, but stopped
working last year because I made it depend on an internal helper which
is only defined for C++17 and up.

	PR libstdc++/94520
	* include/std/charconv (__integer_to_chars_result_type)
	(__integer_from_chars_result_type): Use __or_ instead of __or_v_ to
	allow use in C++14.
	* testsuite/20_util/from_chars/1.cc: Run test as C++14 and replace
	use of std::string_view with std::string.
	* testsuite/20_util/from_chars/2.cc: Likewise.
	* testsuite/20_util/to_chars/1.cc: Likewise.
	* testsuite/20_util/to_chars/2.cc: Likewise.
2020-04-07 17:18:21 +01:00
Jonathan Wakely b696698767 libstdc++: Make string_view::copy usable in constant expressions (PR 94498)
PR libstdc++/94498
	* include/bits/char_traits.h (__gnu_cxx::char_traits::move): Make it
	usable in constant expressions for C++20.
	(__gnu_cxx::char_traits::copy, __gnu_cxx::char_traits::assign): Add
	_GLIBCXX20_CONSTEXPR.
	(std::char_traits<char>, std::char_traits<wchar_t>)
	(std::char_traits<char8_t>): Make move, copy and assign usable in
	constant expressions for C++20.
	(std::char_traits<char16_t>, std::char_traits<char32_t>): Make move
	and copy usable in constant expressions for C++20.
	* include/std/string_view (basic_string_view::copy): Add
	_GLIBCXX20_CONSTEXPR.
	* testsuite/21_strings/basic_string_view/operations/copy/char/
	constexpr.cc: New test.
	* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/
	constexpr.cc: New test.
2020-04-06 18:30:53 +01:00
Gerald Pfeifer 2a1a0c8c0d libstdc++: Refer to Git documentation
* doc/xml/manual/appendix_contributing.xml: Refer to Git
	documentation instead of Subversion.  Switch to https.
	* doc/html/manual/appendix_contributing.html: Regenerate.
2020-04-05 23:56:53 +02:00
Jonathan Wakely 24fe8c8e33 libstdc++: Fix std::to_address for debug iterators (PR 93960)
It should be valid to use std::to_address on a past-the-end iterator,
but the debug mode iterators do a check for dereferenceable in their
operator->(). That check is generally useful, so rather than remove it
this changes std::__to_address to identify a debug mode iterator and
use base().operator->() to skip the check.

	PR libstdc++/93960
	* include/bits/ptr_traits.h (__to_address): Add special case for debug
	iterators, to avoid dereferenceable check.
	* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line number.
	* testsuite/20_util/to_address/debug.cc: New test.
2020-04-03 10:42:20 +01:00
Andrea Corallo c1effaa209 libstdc++-v3/test: Better skip for "use_service.cc"
2020-04-01  Andrea Corallo  <andrea.corallo@arm.com>

	* testsuite/experimental/net/execution_context/use_service.cc:
	Require pthread and gthreads.
2020-04-02 11:53:58 +02:00
Gerald Pfeifer 6c557ba538 libstdc++: Move "free books" list from fsf.org to gnu.org
* doc/xml/manual/appendix_free.xml: Move "free books" list from
	fsf.org to gnu.org.
	* doc/html/manual/appendix_free.html: Regenerate.
2020-04-01 22:45:35 +02:00
Ville Voutilainen e06cde870e Library-side tests for parenthesized aggregate init
PR c++/92878
PR c++/92947

* testsuite/20_util/allocator_traits/members/92878_92947.cc: New.
* testsuite/20_util/any/assign/92878_92947.cc: Likewise.
* testsuite/20_util/any/cons/92878_92947.cc: Likewise.
* testsuite/20_util/is_constructible/92878_92947.cc: Likewise.
* testsuite/20_util/optional/assignment/92878_92947.cc: Likewise.
* testsuite/20_util/optional/cons/92878_92947.cc: Likewise.
* testsuite/20_util/pair/cons/92878_92947.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/92878_92947.cc: Likewise.
* testsuite/20_util/specialized_algorithms/construct_at/92878_92947.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/92878_92947.cc: Likewise.
* testsuite/20_util/uses_allocator/92878_92947.cc: Likewise.
* testsuite/20_util/variant/92878_92947.cc: Likewise.
* testsuite/23_containers/deque/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/forward_list/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/list/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/map/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/multimap/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/multiset/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/priority_queue/92878_92947.cc: Likewise.
* testsuite/23_containers/queue/92878_92947.cc: Likewise.
* testsuite/23_containers/set/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/stack/92878_92947.cc: Likewise.
* testsuite/23_containers/unordered_map/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_set/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/vector/modifiers/emplace/92878_92947.cc:
Likewise.
2020-03-31 17:07:52 +03:00
Jonathan Wakely f6b2b79040 libstdc++: Fix two tests that fail in C++20 mode
* testsuite/20_util/is_constructible/value-2.cc: Fix test to account
	for changes due to parenthesized aggregate-initialization in C++20.
	* testsuite/20_util/time_point/cons/81468.cc: Fix test to not clash
	with std::chrono::sys_time in C++20.
2020-03-28 21:52:13 +00:00
Jonathan Wakely 42cda3ba45 libstdc++: Fix std::reverse_iterator relational operators
My recent changes to reverse_iterator's comparisons was not the version
of the code (or tests) that I meant to commit, and broke the relational
operators. This fixes them to reverse the order of the comparisons on
the base() iterators.

This also replaces the SFINAE constraints in the return type of the
reverse_iterator and move_iterator comparisons with a requires-clause.
This ensures the constrained overloads are preferred to unconstrained
ones. This means the non-standard same-type overloads can be omitted for
C++20 because they're not needed to solve the problem with std::rel_ops
or the testsuite's greedy_ops::X type.

	* include/bits/stl_iterator.h (reverse_iterator): Use requires-clause
	to constrain C++20 versions of comparison operators. Fix backwards
	logic of relational operators.
	(move_iterator): Use requires-clause to constrain comparison operators
	in C++20. Do not declare non-standard same-type overloads for C++20.
	* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc: Check result
	of comparisons and check using greedy_ops type.
	* testsuite/24_iterators/reverse_iterator/rel_ops_c++20.cc: Likewise.
	* testsuite/24_iterators/move_iterator/greedy_ops.cc: Remove redundant
	main function from compile-only test.
	* testsuite/24_iterators/reverse_iterator/greedy_ops.cc: Likewise.
2020-03-28 21:52:13 +00:00
Jonathan Wakely b8a28a06ea libstdc++: Define __cpp_lib_ranges macro for C++20
Define the feature test macro now that ranges support is complete.

This also changes the preprocessor checks for the __cpp_concepts macro
so that library components depending on concepts are only enabled when
C++20 concepts are supported, and not just for the Concepts TS (which
uses different syntax in places).

	* include/bits/range_cmp.h (__cpp_lib_ranges): Define.
	* include/bits/stl_iterator.h: Check value of __cpp_concepts so that
	C++20 concepts are required.
	* include/bits/stl_iterator_base_types.h: Likewise.
	* include/std/concepts: Likewise.
	* include/std/version: Likewise.
	* testsuite/std/ranges/headers/ranges/synopsis.cc: Check feature test
	macro.
2020-03-27 23:26:03 +00:00
Jonathan Wakely 81a8d137c2 libstdc++: Add remaining C++20 changes to iterator adaptors
This adds the missing parts of P0896R4 to reverse_iterator and
move_iterator, so that they meet the C++20 requirements. This should be
the last piece of P0896R4, meaning ranges support is now complete.

The PR 94354 bug with reverse_iterator's comparisons is fixed for C++20
only, but that change should be extended to C++11, C++14 and C++17 modes
in stage 1.

	* include/bits/stl_iterator.h (reverse_iterator::iterator_concept)
	(reverse_iterator::iterator_category): Define for C++20.
	(reverse_iterator): Define comparison operators correctly for C++20.
	(__normal_iterator): Add constraints to comparison operators for C++20.
	(move_iterator::operator++(int)) [__cpp_lib_concepts]: Define new
	overload for input iterators.
	(move_iterator): Add constraints to comparison operators for C++20.
	Define operator<=> for C++20.
	* testsuite/24_iterators/move_iterator/input_iterator.cc: New test.
	* testsuite/24_iterators/move_iterator/move_only.cc: New test.
	* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc: New test.
	* testsuite/24_iterators/reverse_iterator/rel_ops_c++20.cc: New test.
2020-03-27 23:26:03 +00:00
Jonathan Wakely ae6076b5bc libstdc++: Implement C++20 changes to insert iterators
std::insert_iterator and std::inserter need to be adjusted for C++20, so
that they use ranges::iterator_t. That alias template requires
ranges::begin to be defined. Rather than moving the whole of
ranges::begin (and related details like ranges::enable_borrowed_range)
into <iterator>, this defines a new, simpler version of ranges::begin
that is sufficient for ranges::iterator_t to be defined. This works
because ranges::iterator_t uses an lvalue reference type, so the logic
in ranges::begin for non-lvalue ranges (i.e. borrowed ranges) isn't
needed.

This also adds the missing constexpr specifiers to the other insert
iterators.

	* include/bits/iterator_concepts.h (__detail::__decay_copy)
	(__detail::__member_begin, __detail::__adl_begin): Move here from
	<bits/range_access.h>.
	(__detail::__ranges_begin, __detail::__range_iter_t): Define.
	* bits/range_access.h (__cust_access::__decay_copy)
	(__cust_access::__member_begin, __cust_access::__adl_begin): Move to
	<bits/iterator_concepts.h>.
	(ranges::iterator_t): Use __detail::__range_iter_t.
	* include/bits/stl_iterator.h (back_insert_iterator): Simplify
	conditional compilation. Add _GLIBCXX20_CONSTEXPR to all members.
	(front_insert_iterator): Likewise.
	(insert_iterator): Implement changes from P0896R4 for C++20.
	* testsuite/24_iterators/back_insert_iterator/constexpr.cc: New test.
	* testsuite/24_iterators/front_insert_iterator/constexpr.cc: New test.
	* testsuite/24_iterators/headers/iterator/synopsis_c++17.cc: Adjust
	for inclusion in synopsis_c++20.cc which expects different signatures
	for some function templates.
	* testsuite/24_iterators/insert_iterator/constexpr.cc: New test.
2020-03-27 23:26:01 +00:00
Jonathan Wakely 0302a2de7f libstdc++: Move definition earlier in file
This moves __is_array_convertible so it's not between
__is_nothrow_convertible and its helper, since it isn't related to
those.

	* include/std/type_traits (__is_array_convertible): Move definition
	to immediately after is_convertible.
2020-03-27 22:53:04 +00:00
Jonathan Wakely 16948c54b7 libstdc++: Add some C++20 additions to <chrono>
* include/std/chrono (chrono::days, chrono::weeks, chrono::years)
	(chrono::months, chrono::sys_days, chrono::local_t)
	(chrono::local_time, chrono::local_seconds, chrono::local_days):
	Define for C++20.
	(chrono::time_point): Add missing static assert.
	* testsuite/20_util/time_point/requirements/duration_neg.cc: New test.
	* testsuite/std/time/clock/file/overview.cc: New test.
	* testsuite/std/time/clock/file/members.cc: New test.
	* testsuite/std/time/syn_c++20.cc: New test.
2020-03-26 14:00:12 +00:00
Jonathan Wakely 9673d11ec5 libstdc++: Fix author in previous ChangeLog entry
The previous commit added two tests which were written by Mike Crowe,
not by me. This fixes the ChangeLog entry.
2020-03-25 22:20:42 +00:00