Commit Graph

11442 Commits

Author SHA1 Message Date
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
7a2e715c9a Actually comment the new tests 2020-05-12 07:38:28 +02: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
Martin Liska
03f9754665
Use const for template argument.
libstdc++-v3/ChangeLog:

2020-02-04  Martin Liska  <mliska@suse.cz>

	PR c/92472
	* include/parallel/multiway_merge.h:
	Use const for _Compare template argument.
2020-05-05 15:54:58 +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