Commit Graph

5374 Commits

Author SHA1 Message Date
Jonathan Wakely
95e8fcd3d5 libstdc++: Make test print which random_device tokens work
libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/random_device/cons/token.cc:
	Print results of random_device_available checks.
2021-11-09 15:12:29 +00:00
Jonathan Wakely
3439657b02 libstdc++: Support getentropy and arc4random in std::random_device
This adds additional "getentropy" and "arc4random" tokens to
std::random_device. The former is supported on Glibc and OpenBSD (and
apparently wasm), and the latter is supported on various BSDs.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_GETENTROPY, GLIBCXX_CHECK_ARC4RANDOM):
	Define.
	* configure.ac (GLIBCXX_CHECK_GETENTROPY, GLIBCXX_CHECK_ARC4RANDOM):
	Use them.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* src/c++11/random.cc (random_device): Add getentropy and
	arc4random as sources.
	* testsuite/26_numerics/random/random_device/cons/token.cc:
	Check new tokens.
	* testsuite/26_numerics/random/random_device/entropy.cc:
	Likewise.
2021-11-09 14:40:33 +00:00
Jonathan Wakely
8d2d0a6c43 libstdc++: Make spurious std::random_device FAIL less likely
It's possible that independent reads from /dev/random and /dev/urandom
could produce the same value by chance. Retry if that happens. The
chances of it happening twice are miniscule.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/random_device/cons/token.cc:
	Retry if random devices produce the same value.
2021-11-09 14:40:33 +00:00
Jonathan Wakely
5997e6a6ec libstdc++: Add support for POWER9 DARN instruction to std::random_device
The ISA-3.0 instruction set includes DARN ("deliver a random number")
which can be used similarly to the existing support for RDRAND and RDSEED.

libstdc++-v3/ChangeLog:

	* src/c++11/random.cc [__powerpc__] (USE_DARN): Define.
	(__ppc_darn): New function to use POWER9 DARN instruction.
	(Which): Add 'darn' enumerator.
	(which_source): Check for __ppc_darn.
	(random_device::_M_init): Support "darn" and "hw" tokens.
	(random_device::_M_getentropy): Add darn to switch.
	* testsuite/26_numerics/random/random_device/cons/token.cc:
	Check "darn" token.
	* testsuite/26_numerics/random/random_device/entropy.cc:
	Likewise.
2021-11-05 18:14:40 +00:00
Jonathan Wakely
30b8ec68e2 libstdc++: Add xfail to pretty printer tests that fail in C++20
For some reason the type printer for std::string doesn't work in C++20
mode, so std::basic_string<char, char_traits<char>, allocator<char> is
printed out in full rather than being shown as std::string. It's
probably related to the fact that the extern template declarations are
disabled for C++20, but I don't know why that affects GDB.

For now I'm just marking the relevant tests as XFAIL. That requires
adding support for target selectors to individual GDB directives such as
note-test and whatis-regexp-test.

libstdc++-v3/ChangeLog:

	* testsuite/lib/gdb-test.exp: Add target selector support to the
	dg-final directives.
	* testsuite/libstdc++-prettyprinters/80276.cc: Add xfail for
	C++20.
	* testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/prettyprinters.exp: Tweak
	comment.
2021-11-05 12:22:31 +00:00
Jonathan Wakely
f4130a3eb5 libstdc++: Deprecate std::unexpected and handler functions
These functions have been deprecated since C++11, and were removed in
C++17. The proposal P0323 wants to reuse the name std::unexpected for a
class template, so we will need to stop defining the current function
for C++23 anyway.

This marks them as deprecated for C++11 and up, to warn users they won't
continue to be available. It disables them for C++17 and up, unless the
_GLIBCXX_USE_DEPRECATED macro is defined.

The <unwind-cxx.h> header uses std::unexpected_handler in the public
API, but since that type is the same as std::terminate_handler we can
just use that instead, to avoid warnings about it being deprecated.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/evolution.xml: Document deprecations.
	* doc/html/*: Regenerate.
	* libsupc++/exception (unexpected_handler, unexpected)
	(get_unexpected, set_unexpected): Add deprecated attribute.
	Do not define without _GLIBCXX_USE_DEPRECATED for C++17 and up.
	* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Disable
	deprecated warnings.
	* libsupc++/eh_ptr.cc (std::rethrow_exception): Likewise.
	* libsupc++/eh_terminate.cc: Likewise.
	* libsupc++/eh_throw.cc (__cxa_init_primary_exception):
	Likewise.
	* libsupc++/unwind-cxx.h (struct __cxa_exception): Use
	terminate_handler instead of unexpected_handler.
	(struct __cxa_dependent_exception): Likewise.
	(__unexpected): Likewise.
	* testsuite/18_support/headers/exception/synopsis.cc: Add
	dg-warning for deprecated warning.
	* testsuite/18_support/exception_ptr/60612-unexpected.cc:
	Disable deprecated warnings.
	* testsuite/18_support/set_unexpected.cc: Likewise.
	* testsuite/18_support/unexpected_handler.cc: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/lambda/lambda-eh2.C: Add dg-warning for new
	deprecation warnings.
	* g++.dg/cpp0x/noexcept06.C: Likewise.
	* g++.dg/cpp0x/noexcept07.C: Likewise.
	* g++.dg/eh/forced3.C: Likewise.
	* g++.dg/eh/unexpected1.C: Likewise.
	* g++.old-deja/g++.eh/spec1.C: Likewise.
	* g++.old-deja/g++.eh/spec2.C: Likewise.
	* g++.old-deja/g++.eh/spec3.C: Likewise.
	* g++.old-deja/g++.eh/spec4.C: Likewise.
	* g++.old-deja/g++.mike/eh33.C: Likewise.
	* g++.old-deja/g++.mike/eh34.C: Likewise.
	* g++.old-deja/g++.mike/eh50.C: Likewise.
	* g++.old-deja/g++.mike/eh51.C: Likewise.
2021-11-04 20:53:29 +00:00
Jonathan Wakely
09aab7e699 libstdc++: Optimize std::tuple_element and std::tuple_size_v
This reduces the number of class template instantiations needed for code
using tuples, by reusing _Nth_type in tuple_element and specializing
tuple_size_v for tuple, pair and array (and const-qualified versions of
them).

Also define the _Nth_type primary template as a complete type (but with
no nested 'type' member).  This avoids "invalid use of incomplete type"
errors for out-of-range specializations of tuple_element. Those errors
would probably be confusing and unhelpful for users. We already have
a user-friendly static assert in tuple_element itself.

Also ensure that tuple_size_v is available whenever tuple_size is (as
proposed by LWG 3387). We already do that for tuple_element_t.

libstdc++-v3/ChangeLog:

	* include/bits/stl_pair.h (tuple_size_v): Define partial
	specializations for std::pair.
	* include/bits/utility.h (_Nth_type): Move definition here
	and define primary template.
	(tuple_size_v): Move definition here.
	* include/std/array (tuple_size_v): Define partial
	specializations for std::array.
	* include/std/tuple (tuple_size_v): Move primary template to
	<bits/utility.h>.  Define partial specializations for
	std::tuple.
	(tuple_element): Change definition to use _Nth_type.
	* include/std/variant (_Nth_type): Move to <bits/utility.h>.
	(variant_alternative, variant): Adjust qualification of
	_Nth_type.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Prune
	additional errors from _Nth_type.
2021-11-04 18:14:50 +00:00
Jonathan Wakely
7551a99574 libstdc++: Fix handling of const types in std::variant [PR102912]
Prior to r12-4447 (implementing P2231R1 constexpr changes) we didn't
construct the correct member of the union in __variant_construct_single,
we just plopped an object in the memory occupied by the union:

  void* __storage = std::addressof(__lhs._M_u);
  using _Type = remove_reference_t<decltype(__rhs_mem)>;
  ::new (__storage) _Type(std::forward<decltype(__rhs_mem)>(__rhs_mem));

We didn't care whether we had variant<int, const int>, we would just
place an int (or const int) into the storage, and then set the _M_index
to say which one it was.

In the new constexpr-friendly code we use std::construct_at to construct
the union object, which constructs the active member of the right type.
But now we need to know exactly the right type. We have to distinguish
between alternatives of type int and const int, and we have to be able
to find a const int (or const std::string, as in the OP) among the
alternatives. So my change from remove_reference_t<decltype(__rhs_mem)>
to remove_cvref_t<_Up> was wrong. It strips the const from const int,
and then we can't find the index of the const int alternative.

But just using remove_reference_t doesn't work either. When the copy
assignment operator of std::variant<int> uses __variant_construct_single
it passes a const int& as __rhs_mem, but if we don't strip the const
then we try to find const int among the alternatives, and *that* fails.
Similarly for the copy constructor, which also uses a const int& as the
initializer for a non-const int alternative.

The root cause of the problem is that __variant_construct_single doesn't
know the index of the type it's supposed to construct, and the new
_Variant_storage::__index_of<_Type> helper doesn't work if __rhs_mem and
the alternative being constructed have different const-qualification. We
need to replace __variant_construct_single with something that knows the
index of the alternative being constructed. All uses of that function do
actually know the index, but that context is lost by the time we call
__variant_construct_single. This patch replaces that function and
__variant_construct, inlining their effects directly into the callers.

libstdc++-v3/ChangeLog:

	PR libstdc++/102912
	* include/std/variant (_Variant_storage::__index_of): Remove.
	(__variant_construct_single): Remove.
	(__variant_construct): Remove.
	(_Copy_ctor_base::_Copy_ctor_base(const _Copy_ctor_base&)): Do
	construction directly instead of using __variant_construct.
	(_Move_ctor_base::_Move_ctor_base(_Move_ctor_base&&)): Likewise.
	(_Move_ctor_base::_M_destructive_move()): Remove.
	(_Move_ctor_base::_M_destructive_copy()): Remove.
	(_Copy_assign_base::operator=(const _Copy_assign_base&)): Do
	construction directly instead of using _M_destructive_copy.
	(variant::swap): Do construction directly instead of using
	_M_destructive_move.
	* testsuite/20_util/variant/102912.cc: New test.
2021-11-04 09:36:09 +00:00
Jonathan Wakely
1e7a269856 libstdc++: Fix regression in std::list::sort [PR66742]
The standard does not require const-correct comparisons in list::sort.

libstdc++-v3/ChangeLog:

	PR libstdc++/66742
	* include/bits/list.tcc (list::sort): Use mutable iterators for
	comparisons.
	* include/bits/stl_list.h (_Scratch_list::_Ptr_cmp): Likewise.
	* testsuite/23_containers/list/operations/66742.cc: Check
	non-const comparisons.
2021-11-03 15:15:27 +00:00
Jonathan Wakely
6f34b9e4f1 libstdc++: Missing constexpr for __gnu_debug::__valid_range etc
The new 25_algorithms/move/constexpr.cc test fails in debug mode,
because the debug assertions use the non-constexpr overloads in
<debug/stl_iterator.h>.

libstdc++-v3/ChangeLog:

	* include/debug/stl_iterator.h (__valid_range): Add constexpr
	for C++20. Qualify call to avoid ADL.
	(__get_distance, __can_advance, __unsafe, __base): Likewise.
	* testsuite/25_algorithms/move/constexpr.cc: Also check with
	std::reverse_iterator arguments.
2021-11-01 21:01:31 +00:00
Jonathan Wakely
91bac9fed5 libstdc++: Fix range access for empty std::valarray [PR103022]
The std::begin and std::end overloads for std::valarray are defined in
terms of std::addressof(v[0]) which is undefined for an empty valarray.

libstdc++-v3/ChangeLog:

	PR libstdc++/103022
	* include/std/valarray (begin, end): Do not dereference an empty
	valarray. Add noexcept and [[nodiscard]].
	* testsuite/26_numerics/valarray/range_access.cc: Check empty
	valarray. Check iterator properties. Run as well as compiling.
	* testsuite/26_numerics/valarray/range_access2.cc: Likewise.
	* testsuite/26_numerics/valarray/103022.cc: New test.
2021-11-01 13:26:29 +00:00
Jonathan Wakely
d27febaf00 libstdc++: Fix typo in std::stack test
libstdc++-v3/ChangeLog:

	* testsuite/23_containers/stack/deduction.cc: Fix typo.
2021-10-29 21:34:54 +01:00
Martin Sebor
9a27acc30a Make full use of context-sensitive ranges in access warnings.
gcc/ChangeLog:

	* builtins.c (check_strncat_sizes): Pass access_data ctor additional
	arguments.
	(expand_builtin_memcmp): Move code to gimple-ssa-warn-access.cc.
	(expand_builtin_fork_or_exec): Same.
	* gimple-array-bounds.cc (array_bounds_checker::check_mem_ref): Pass
	compute_objsize additional arguments.
	(inbounds_memaccess_p): Same.
	(array_bounds_checker::check_array_bounds): Add an assert.  Stash
	statement in a member.
	(check_array_bounds_dom_walker::before_dom_children): Same.
	* gimple-array-bounds.h (array_bounds_checker::m_stmt): New member.
	* gimple-ssa-sprintf.c (get_destination_size): Add an argument.
	(handle_printf_call): Pass a new argument.
	* gimple-ssa-warn-access.cc (get_size_range): Add an argument.
	(check_access): Add an argument and pass it along to callees.
	(check_read_access): Make a member function.
	(pass_waccess::check_strcat): Pass access_data ctor additional
	arguments.
	(pass_waccess::check_strncat): Same.
	(pass_waccess::check_stxcpy): Same.
	(pass_waccess::check_stxncpy): Same.
	(pass_waccess::check_strncmp): Same.
	(pass_waccess::check_read_access): Same.
	(pass_waccess::check_builtin): Same.
	(pass_waccess::maybe_check_access_sizes): Same.
	(pass_waccess::maybe_check_dealloc_call): Same.
	* gimple-ssa-warn-access.h (check_read_access): Declare a new
	member function.
	* pointer-query.cc (compute_objsize_r): Add an argument.
	(gimple_call_return_array): Same.
	(gimple_call_alloc_size): Same.
	(access_ref::access_ref): Same.
	(access_ref::get_ref): Same.
	(pointer_query::get_ref): Same.
	(handle_min_max_size): Pass an arguments to callees.
	(handle_array_ref): Add an argument.
	(handle_mem_ref): Same.
	(compute_objsize): Same.
	* pointer-query.h (struct access_ref): Adjust signatures.
	(struct access_data): Same.
	(gimple_call_alloc_size): Add an argument.
	(gimple_parm_array_size): Same.
	(compute_objsize): Same.
	* tree-ssa-strlen.c (strlen_pass::adjust_last_stmt): Pass an additional
	argument to compute_objsize.
	(strlen_pass::maybe_warn_overflow): Same.
	(maybe_diag_stxncpy_trunc): Same.

gcc/testsuite/ChangeLog:

	* gcc.dg/Wstringop-overflow-22.c: Correct typos.
	* gcc.dg/Wstringop-overflow-81.c: New test.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string/capacity/1.cc: Also suppress
	-Wstringop-overread.
	* testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc: Same.
2021-10-26 16:53:23 -06:00
Rainer Orth
931f1e377a libstdc++: Fix 28_regex/basic_regex/84110.cc on Solaris
28_regex/basic_regex/84110.cc currently FAILs on Solaris:

FAIL: 28_regex/basic_regex/84110.cc (test for excess errors)
UNRESOLVED: 28_regex/basic_regex/84110.cc compilation failed to produce executable

Excess errors:
/vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/28_regex/basic_regex/84110.cc:14: error: reference to 'extended' is ambiguous

The issue is seen in the full output:

/vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/28_regex/basic_regex/84110.cc: In function ‘void test01()’:
/vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/28_regex/basic_regex/84110.cc:14: error: reference to ‘extended’ is ambiguous
In file included from /var/gcc/regression/master/11.4-gcc-gas/build/gcc/include-fixed/math.h:391,
                 from /var/gcc/regression/master/11.4-gcc-gas/build/i386-pc-solaris2.11/libstdc++-v3/include/cmath:45,
                 from /vol/gcc/src/hg/master/local/libstdc++-v3/include/precompiled/stdc++.h:41:
/usr/include/floatingpoint.h:73: note: candidates are: ‘typedef unsigned int extended [3]’

Fixed by disambiguating extended.  Tested on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.


2021-10-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libstdc++-v3:
	* testsuite/28_regex/basic_regex/84110.cc (test01)
	[__cpp_exceptions]: Disambiguate extended.
2021-10-26 14:07:57 +02:00
Rainer Orth
88037d82d7 libstdc++: Fix 17_intro/names.cc on Solaris
17_intro/names.cc and experimental/names.cc currently FAIL on Solaris

FAIL: 17_intro/names.cc (test for excess errors)
FAIL: experimental/names.cc (test for excess errors)

Excess errors:
/usr/include/sys/timespec_util.h:22: error: expected ')' before ';' token
/usr/include/stdlib.h:157: error: expected unqualified-id before '[' token
/usr/include/stdlib.h:157: error: expected ')' before '[' token

<sys/timespec_util.h> has

extern int timespeccompare(const struct timespec *l, const struct timespec *r);

while <stdlib.h> has

typedef struct drand48_data {
        unsigned int _initialised;
        unsigned short int x[3];
        unsigned short int a[3];
        unsigned int c;
        unsigned short lastx[3];
} drand48_data;

both of which are broken by defining r resp. x to ( in the testcase.

Fixed by undoing the defines.  Tested on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.


2021-10-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libstdc++-v3:
	* testsuite/17_intro/names.cc [__sun__] (r, x): Undef.
2021-10-26 14:00:18 +02:00
Jonathan Wakely
0c1f737a48 libstdc++: Constrain std::make_any [PR102894]
std::make_any should be constrained so it can only be called if the
construction of the return value would be valid.

libstdc++-v3/ChangeLog:

	PR libstdc++/102894
	* include/std/any (make_any): Add SFINAE constraint.
	* testsuite/20_util/any/102894.cc: New test.
2021-10-22 23:09:54 +01:00
Patrick Palka
5f7976f65b libstdc++: missing constexpr for __[nm]iter_base [PR102358]
PR libstdc++/102358

libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h (__niter_base): Make constexpr
	for C++20.
	(__miter_base): Likewise.
	* testsuite/25_algorithms/move/constexpr.cc: New test.
2021-10-21 12:13:35 -04:00
Patrick Palka
48154969d4 libstdc++: Implement P2432R1 changes for views::istream
libstdc++-v3/ChangeLog:

	* include/std/ranges (istream_view): Replace this function
	template with an alias template as per P2432R1.
	(wistream_view): Define as per P2432R1.
	(views::_Istream, views::istream): Likewise.
	* testsuite/std/ranges/istream_view.cc (test07): New test.
2021-10-21 11:55:19 -04:00
Patrick Palka
9626e44713 libstdc++: Implement P1739R4 changes to views::take/drop/counted
This implements P1739R4 along with the resolution for LWG 3407 which
corrects the paper's wording.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_util.h (views::_Drop): Forward declare.
	(subrange): Befriend views::_Drop.
	(subrange::_S_store_size): Declare constexpr instead of just
	const, remove obsolete comment.
	* include/std/ranges (views::__detail::__is_empty_view): Define.
	(views::__detail::__is_basic_string_view): Likewise.
	(views::__detail::__is_subrange): Likewise.
	(views::__detail::__is_iota_view): Likewise.
	(views::__detail::__can_take_view): Rename template parm _Tp to _Dp.
	(views::_Take): Rename template parm _Tp to _Dp, make it non-deducible
	and fix it to range_difference_t<_Range>.  Implement P1739R4 and
	LWG 3407 changes.
	(views::__detail::__can_drop_view): Rename template parm _Tp to _Dp.
	(views::_Drop): As with views::_Take.
	(views::_Counted): Implement P1739R4 changes.
	* include/std/span (__detail::__is_std_span): Rename to ...
	(__detail::__is_span): ... this and turn it into a variable
	template.
	(__detail::__is_std_array): Turn it into a variable template.
	(span::span): Adjust uses of __is_std_span and __is_std_array
	accordingly.
	* testsuite/std/ranges/adaptors/p1739.cc: New test.
2021-10-21 11:55:16 -04:00
Patrick Palka
a2c2dcc6ca libstdc++: Implement LWG 3481 change to ranges::viewable_range
libstdc++-v3/ChangeLog:

	* include/bits/ranges_base.h (viewable_range): Adjust as per
	LWG 3481.
	* testsuite/std/ranges/adaptors/all.cc (test07): New test.
2021-10-20 21:34:18 -04:00
Jonathan Wakely
0fac85a24f libstdc++: Remove constraints from std::optional monadic ops [PR102863]
The constraints on transform and and_then can cause errors when checking
satisfaction. The constraints that were present in R6 of the paper were
moved for he final F8 revision, and so should have been included in the
implementation.

libstdc++-v3/ChangeLog:

	PR libstdc++/102863
	* include/std/optional (optional::and_then, optional::transform):
	Remove requires-clause.
	* testsuite/20_util/optional/monadic/and_then.cc: Check
	overload resolution doesn't cause errors.
	* testsuite/20_util/optional/monadic/transform.cc: Likewise.
2021-10-21 01:23:22 +01:00
Jonathan Wakely
4ba4b05315 libstdc++: Add missing test for std::optional::transform(F&&)
The test_copy_elision() function was supposed to ensure that the result
is constructed directly in the std::optional, without early temporary
materialization. But I forgot to write the test.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/optional/monadic/transform.cc: Check that
	an rvalue result is not materialized too soon.
2021-10-20 20:20:18 +01:00
Patrick Palka
98af6b86bc libstdc++: Implement LWG 3470 change to ranges::subrange
libstdc++-v3/ChangeLog:

	* include/bits/ranges_util.h
	(__detail::__uses_nonqualification_pointer_conversion): Define
	and use it ...
	(__detail::__convertible_to_nonslicing): ... here, as per LWG 3470.
	* testsuite/std/ranges/subrange/1.cc: New test.
2021-10-19 18:07:05 -04:00
Patrick Palka
861440a77b libstdc++: Implement LWG 3523 changes to ranges::iota_view
libstdc++-v3/ChangeLog:

	* include/std/ranges (iota_view::_Iterator): Befriend iota_view.
	(iota_view::_Sentinel): Likewise.
	(iota_view::iota_view): Add three overloads, each taking an
	iterator/sentinel pair as per LWG 3523.
	* testsuite/std/ranges/iota/iota_view.cc (test06): New test.
2021-10-19 17:54:24 -04:00
Patrick Palka
53b1c382d5 libstdc++: Implement LWG 3549 changes to ranges::enable_view
This patch also reverts r11-3504 since that workaround is now obsolete
after this resolution.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_base.h (view_interface): Forward declare.
	(__detail::__is_derived_from_view_interface_fn): Declare.
	(__detail::__is_derived_from_view_interface): Define as per LWG 3549.
	(enable_view): Adjust as per LWG 3549.
	* include/bits/ranges_util.h (view_interface): Don't derive from
	view_base.
	* include/std/ranges (filter_view): Revert r11-3504 change.
	(transform_view): Likewise.
	(take_view): Likewise.
	(take_while_view): Likewise.
	(drop_view): Likewise.
	(drop_while_view): Likewise.
	(join_view): Likewise.
	(lazy_split_view): Likewise.
	(split_view): Likewise.
	(reverse_view): Likewise.
	* testsuite/std/ranges/adaptors/sizeof.cc: Update expected sizes.
	* testsuite/std/ranges/view.cc (test_view::test_view): Remove
	this default ctor since views no longer need to be default initable.
	(test01): New test.
2021-10-19 17:50:56 -04:00
Jonathan Wakely
58f339fc5e libstdc++: Implement std::random_device::entropy() for other sources
Currently this function only returns a non-zero value for /dev/random
and /dev/urandom. When a hardware instruction such as RDRAND is in use
it should (in theory) be perfectly random and produce 32 bits of entropy
in each 32-bit result. Add a helper function to identify the source of
randomness from the _M_func and _M_file data members, and return a
suitable value when RDRAND or RDSEED is being used.

libstdc++-v3/ChangeLog:

	* src/c++11/random.cc (which_source): New helper function.
	(random_device::_M_getentropy()): Use which_source and return
	suitable values for sources other than device files.
	* testsuite/26_numerics/random/random_device/entropy.cc: New test.
2021-10-19 17:27:06 +01:00
Jonathan Wakely
c4ecb11e4f libstdc++: Fix std::stack deduction guide
libstdc++-v3/ChangeLog:

	* include/bits/stl_stack.h (stack(Iterator, Iterator)): Remove
	non-deducible template parameter from deduction guide.
	* testsuite/23_containers/stack/deduction.cc: Check new C++23
	deduction guides.
2021-10-19 15:01:16 +01:00
Jonathan Wakely
82b2e4f8cf libstdc++: Implement monadic operations for std::optional (P0798R8)
Another new addition to the C++23 working draft.

The new member functions of std::optional are only defined for C++23,
but the new members of _Optional_payload_base are defined for C++20 so
that they can be used in non-propagating-cache in <ranges>. The
_Optional_payload_base::_M_construct member can also be used in
non-propagating-cache now, because it's constexpr since r12-4389.

There will be an LWG issue about the feature test macro, suggesting that
we should just bump the value of __cpp_lib_optional instead. I haven't
done that here, but it can be changed once consensus is reached on the
change.

libstdc++-v3/ChangeLog:

	* include/std/optional (_Optional_payload_base::_Storage): Add
	constructor taking a callable function to invoke.
	(_Optional_payload_base::_M_apply): New function.
	(__cpp_lib_monadic_optional): Define for C++23.
	(optional::and_then, optional::transform, optional::or_else):
	Define for C++23.
	* include/std/ranges (__detail::__cached): Remove.
	(__detail::__non_propagating_cache): Remove use of __cached for
	contained value. Use _Optional_payload_base::_M_construct and
	_Optional_payload_base::_M_apply to set the contained value.
	* include/std/version (__cpp_lib_monadic_optional): Define.
	* testsuite/20_util/optional/monadic/and_then.cc: New test.
	* testsuite/20_util/optional/monadic/or_else.cc: New test.
	* testsuite/20_util/optional/monadic/or_else_neg.cc: New test.
	* testsuite/20_util/optional/monadic/transform.cc: New test.
	* testsuite/20_util/optional/monadic/version.cc: New test.
2021-10-19 15:01:16 +01:00
Jonathan Wakely
9890b12c72 libstdc++: Fix mem-initializer in std::move_only_function [PR102825]
libstdc++-v3/ChangeLog:

	PR libstdc++/102825
	* include/bits/mofunc_impl.h (move_only_function): Remove
	invalid base initializer.
	* testsuite/20_util/move_only_function/cons.cc: Instantiate
	constructors to check bodies.
2021-10-19 11:50:46 +01:00
Jonathan Wakely
929abc7fe3 libstdc++: Define std::basic_string::resize_and_overwrite for C++23 (P1072R10)
A recently approved change for the C++23 working draft.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (__cpp_lib_string_resize_and_overwrite):
	Define for C++23.
	(basic_string::resize_and_overwrite): Declare.
	* include/bits/basic_string.tcc (basic_string::resize_and_overwrite):
	Define.
	* include/std/version (__cpp_lib_resize_and_overwrite): Define
	for C++23.
	* testsuite/21_strings/basic_string/capacity/char/resize_and_overwrite.cc:
	New test.
2021-10-16 00:44:16 +01:00
Jonathan Wakely
2c564e813c libstdc++: Make non-propagating-cache fully constexpr [PR101263]
libstdc++-v3/ChangeLog:

	PR libstdc++/101263
	* include/std/ranges (__cached): New wrapper struct.
	(__non_propagating_cache): Use __cached for contained value.
	(__non_propagating_cache::_M_emplace_deref): Add constexpr. Use
	std::construct_at instead of placement new.
	* testsuite/std/ranges/adaptors/join.cc: Check constexpr works.
2021-10-15 18:26:53 +01:00
Jonathan Wakely
ad820b0bb5 libstdc++: Add missing constexpr to std::variant (P2231R1)
This implements the changes in P2231R1 which make std::variant fully
constexpr in C++20.

We need to replace placement new with std::construct_at, but that isn't
defined for C++17. Use std::_Construct instead, which forwards to
std::construct_at in C++20 mode (since the related changes to make
std::optional fully constexpr, in r12-4389).

We also need to replace the untyped char buffer in _Uninitialized with a
union, which can be accessed in constexpr functions. But the union needs
to have a non-trivial destructor if its variant type is non-trivial,
which means that the _Variadic_union also needs a non-trivial
destructor. This adds a constrained partial specialization of
_Variadic_union for the C++20-only case where a non-trivial destructor
is needed.

We can't use concepts to constrain the specialization (or the primary
template's destructor) in C++17, so retain the untyped char buffer
solution for C++17 mode.

libstdc++-v3/ChangeLog:

	* include/std/variant (__cpp_lib_variant): Update value for
	C++20.
	(__variant_cast, __variant_construct): Add constexpr for C++20.
	(__variant_construct_single, __construct_by_index) Likewise. Use
	std::_Construct instead of placement new.
	(_Uninitialized<T, false>) [__cplusplus >= 202002]: Replace
	buffer with a union and define a destructor.
	(_Variadic_union) [__cplusplus >= 202002]: Add a specialization
	for non-trivial destruction.
	(_Variant_storage::__index_of): New helper variable template.
	(_Variant_storage::~_Variant_storage()): Add constexpr.
	(_Variant_storage::_M_reset()): Likewise.
	(_Copy_ctor_base, _Move_ctor_base): Likewise.
	(_Copy_assign_base, _Move_assign_base): Likewise.
	(variant, swap): Likewise.
	* include/std/version (__cpp_lib_variant): Update value for
	C++20.
	* testsuite/20_util/optional/version.cc: Check for exact value
	in C++17.
	* testsuite/20_util/variant/87619.cc: Increase timeout for
	C++20 mode.
	* testsuite/20_util/variant/constexpr.cc: New test.
	* testsuite/20_util/variant/version.cc: New test.
2021-10-15 18:26:53 +01:00
Jason Merrill
1595fe44e1 c++: instantiate less for constant folding
I've been experimenting with a change to make all inline functions
implicitly constexpr; this revealed that we are instantiating too
aggressively for speculative constant evaluation, leading to ordering
difficulties with e.g. is_a_helper<cgraph_node*>::test.  This patch tries to
avoid such instantiation until we actually need the function definition to
determine whether a call is constant, by limiting the initial instantiation
of all used functions to manifestly-constant-evaluated expressions, and
checking whether the function arguments are constant before instantiating
the function.

This change resulted in a change in the diagnostics for a few library tests
due to instantiating the function with the static_assert later (during
constant evaluation) than we did before (during instantiation of the
intermediate function).

gcc/cp/ChangeLog:

	* constexpr.c (cxx_bind_parameters_in_call): Replace
	new_call parameter with fun.
	(cxx_eval_call_expression): Call it before instantiation.
	(cxx_eval_outermost_constant_expr): Only instantiate fns
	when manifestly_const_eval.
	* typeck2.c (check_narrowing): This context is manifestly
	constant-evaluated.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/integer_comparisons/greater_equal_neg.cc:
	* testsuite/20_util/integer_comparisons/greater_neg.cc:
	* testsuite/20_util/integer_comparisons/less_equal_neg.cc:
	Adjust expected message.
	* testsuite/lib/prune.exp: Prune 'in constexpr expansion'.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/vla22.C: Don't expect a narrowing error.
	* g++.dg/cpp0x/constexpr-inst1.C: New test.
2021-10-14 21:40:11 -04:00
Jonathan Wakely
6e3bfd60e8 libstdc++: Fix test for feature test macro
libstdc++-v3/ChangeLog:

	* testsuite/20_util/is_layout_compatible/version.cc: Check
	correct macro.
2021-10-14 09:08:01 +01:00
Jonathan Wakely
476f305b6c libstdc++: Add missing constexpr to std::optional (P2231R1)
This implements the changes in P2231R1 which make std::optional fully
constexpr in C++20.

libstdc++-v3/ChangeLog:

	* include/bits/stl_construct.h (_Construct): Use
	std::construct_at when constant evaluated.
	* include/std/optional (_Storage, _Optional_payload, optional):
	Add constexpr as specified by P2231R1.
	* include/std/version (__cpp_lib_optional): Update value for
	C++20.
	* testsuite/20_util/optional/requirements.cc: Check feature test
	macro.
	* testsuite/20_util/optional/constexpr/assign.cc: New test.
	* testsuite/20_util/optional/constexpr/cons/conv.cc: New test.
	* testsuite/20_util/optional/constexpr/modifiers.cc: New test.
	* testsuite/20_util/optional/constexpr/swap.cc: New test.
	* testsuite/20_util/optional/version.cc: New test.
2021-10-14 09:08:01 +01:00
Jonathan Wakely
ce55693604 libstdc++: Rename files with the wrong extensions
libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/path/construct/102592.C: Moved to...
	* testsuite/27_io/filesystem/path/construct/102592.cc: ...here.
	* testsuite/28_regex/match_results/102667.C: Moved to...
	* testsuite/28_regex/match_results/102667.cc: ...here.
2021-10-13 22:35:14 +01:00
Jonathan Wakely
85b24e32dc libstdc++: Fix dangling string_view in filesystem::path [PR102592]
When creating a path from a pair of non-contiguous iterators we pass the
iterators to _S_convert(Iter, Iter). That function passes the iterators
to __string_from_range to get a contiguous sequence of characters, and
then calls _S_convert(const C*, const C*) to perform the encoding
conversions. If the value type, C, is char8_t, then no conversion is
needed and the _S_convert<char8_t>(const char8_t*, const char8_t*)
specialization casts the pointer to const char* and returns a
std::string_view that refs to the char8_t sequence. However, that
sequence is owned by the std::u8string rvalue returned by
__string_from_range, which goes out of scope when _S_convert(Iter, Iter)
returns. That means the std::string_view is dangling and we get
undefined behaviour when parsing it as a path.

The same problem does not exist for the path members taking a "Source"
argument, because those functions all convert a non-contiguous range
into a basic_string<C> immediately, using __effective_range(__source).
That means that the rvalue string returned by that function is still in
scope for the full expression, so the string_view does not dangle.

The solution for the buggy functions is to do the same thing, and call
__string_from_range immediately, so that the returned rvalue is still in
scope for the lifetime of the string_view returned by _S_convert. To
avoid reintroducing the same problem, remove the _S_convert(Iter, Iter)
overload that calls __string_from_range and returns a dangling view.

libstdc++-v3/ChangeLog:

	PR libstdc++/102592
	* include/bits/fs_path.h (path::path(Iter, Iter, format))
	(path::append(Iter, Iter), path::concat(Iter, Iter)): Call
	__string_from_range directly, instead of two-argument overload
	of _S_convert.
	(path::_S_convert(Iter, Iter)): Remove.
	* testsuite/27_io/filesystem/path/construct/102592.C: New test.
2021-10-13 20:36:51 +01:00
Jonathan Wakely
727137d6ca libstdc++: Fix test that fails for C++20
Also restore the test for 'a < a' that was removed by r12-2537 because
it is ill-formed. We still want to test operator< for tuple, we just
need to not use std::nullptr_t in that tuple type.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/tuple/comparison_operators/overloaded.cc:
	Restore test for operator<.
	* testsuite/20_util/tuple/comparison_operators/overloaded2.cc:
	Adjust expected errors for C++20.
2021-10-12 16:05:15 +01:00
Jonathan Wakely
7481021364 libstdc++: Fix move construction of std::tuple with array elements [PR101960]
The r12-3022 commit only fixed the case where an array is the last
element of the tuple. This fixes the other cases too. We can just define
the move constructor as defaulted, which does the right thing. Changing
the move constructor to be trivial would be an ABI break, but since the
last base class still has a non-trivial move constructor, defining the
derived ones as defaulted doesn't change anything.

libstdc++-v3/ChangeLog:

	PR libstdc++/101960
	* include/std/tuple (_Tuple_impl(_Tuple_impl&&)): Define as
	defauled.
	* testsuite/20_util/tuple/cons/101960.cc: Check tuples with
	array elements before the last element.
2021-10-12 16:05:15 +01:00
Jonathan Wakely
45ba5426c1 libstdc++: Fix std::numeric_limits::lowest() test for strict modes
This test uses std::is_integral to decide whether we are testing an
integral or floating-point type. But that fails for __int128 because
is_integral<__int128> is false in strict modes. By using
numeric_limits::is_integer instead we get the right answer for all types
that have a numeric_limits specialization.

We can also simplify the test by removing the unnecessary tag
dispatching.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/numeric_limits/lowest.cc: Use
	numeric_limits<T>::is_integer instead of is_integral<T>::value.
2021-10-11 20:34:17 +01:00
Jonathan Wakely
84088dc4bb libstdc++: Fix std::match_results::end() for failed matches [PR102667]
The end() function needs to consider whether the underlying vector is
empty, not whether the match_results object is empty. That's because the
underlying vector will always contain at least three elements for a
match_results object that is "ready". It contains three extra elements
which are stored in the vector but are not considered part of sequence,
and so should not be part of the [begin(),end()) range.

libstdc++-v3/ChangeLog:

	PR libstdc++/102667
	* include/bits/regex.h (match_result::empty()): Optimize by
	calling the base function directly.
	(match_results::end()): Check _Base_type::empty() not empty().
	* testsuite/28_regex/match_results/102667.C: New test.
2021-10-11 20:34:16 +01:00
Jonathan Wakely
fec283b63d libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725]
Now that std::wstring and other specializations for wchar_t are defined
unconditionally, many checks for _GLIBCXX_USE_WCHAR_T in the testsuite
are unnecessary and can be removed. Tests for iostreams, locales, regex
and filesystem::path still need to be guarded by _GLIBCXX_USE_WCHAR_T
because those components depend on libc support in <wchar.h> and other
headers.

libstdc++-v3/ChangeLog:

	PR libstdc++/98725
	* testsuite/18_support/numeric_limits/lowest.cc: Remove use of
	_GLIBCXX_USE_WCHAR_T.
	* testsuite/18_support/numeric_limits/min_max.cc: Replace use of
	_GLIBCXX_USE_WCHAR_T with checks for WCHAR_MIN and WCHAR_MAX.
	* testsuite/20_util/from_chars/1_neg.cc: Remove use of
	_GLIBCXX_USE_WCHAR_T.
	* testsuite/20_util/function_objects/searchers.cc: Likewise. Use
	char_traits<wchar_t>::length instead of wcslen.
	* testsuite/20_util/hash/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_arithmetic/value.cc: Likewise.
	* testsuite/20_util/is_compound/value.cc: Likewise.
	* testsuite/20_util/is_floating_point/value.cc: Likewise.
	* testsuite/20_util/is_fundamental/value.cc: Likewise.
	* testsuite/20_util/is_integral/value.cc: Likewise.
	* testsuite/20_util/is_signed/value.cc: Likewise.
	* testsuite/20_util/is_unsigned/value.cc: Likewise.
	* testsuite/20_util/is_void/value.cc: Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs-1.cc:
	Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs-2.cc:
	Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs-3.cc:
	Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs-4.cc:
	Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs-1.cc:
	Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs-2.cc:
	Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs-3.cc:
	Likewise.
	* testsuite/20_util/to_chars/3.cc: Likewise.
	* testsuite/20_util/type_identity/requirements/typedefs.cc:
	Likewise.
	* testsuite/21_strings/basic_string/hash/debug.cc: Likewise.
	* testsuite/21_strings/basic_string/hash/hash.cc: Likewise.
	* testsuite/21_strings/basic_string/literals/types-char8_t.cc:
	Likewise.
	* testsuite/21_strings/basic_string/literals/types.cc: Likewise.
	* testsuite/21_strings/basic_string/literals/values-char8_t.cc:
	Likewise.
	* testsuite/21_strings/basic_string/literals/values.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/64422.cc:
	Likewise.
	* testsuite/21_strings/basic_string/range_access/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/citerators.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/typedefs.cc:
	Likewise.
	* testsuite/21_strings/basic_string/types/pmr_typedefs.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/literals/types-char8_t.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/literals/types.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/literals/values-char8_t.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/literals/values.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/typedefs.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/typedefs.cc: Likewise.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions.cc:
	Likewise.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
	Likewise.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
	Likewise.
	* testsuite/22_locale/ctype/is/string/89728_neg.cc: Likewise.
	* testsuite/25_algorithms/fill/4.cc: Likewise.
	* testsuite/25_algorithms/fill_n/1.cc: Likewise.
	* testsuite/experimental/functional/searchers.cc: Likewise. Use
	char_traits<wchar_t>::length instead of wcslen.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
	Likewise.
	* testsuite/experimental/string_view/literals/types-char8_t.cc:
	Likewise.
	* testsuite/experimental/string_view/literals/types.cc:
	Likewise.
	* testsuite/experimental/string_view/literals/values-char8_t.cc:
	Likewise.
	* testsuite/experimental/string_view/literals/values.cc:
	Likewise.
	* testsuite/experimental/string_view/range_access/wchar_t/1.cc:
	Likewise.
	* testsuite/experimental/string_view/requirements/typedefs.cc:
	Likewise.
	* testsuite/experimental/string_view/typedefs.cc: Likewise.
	* testsuite/ext/vstring/range_access.cc: Likewise.
	* testsuite/std/concepts/concepts.lang/concept.arithmetic/integral.cc:
	Likewise.
	* testsuite/std/concepts/concepts.lang/concept.arithmetic/signed_integral.cc:
	Likewise.
	* testsuite/std/concepts/concepts.lang/concept.arithmetic/unsigned_integral.cc:
	Likewise.
	* testsuite/tr1/4_metaprogramming/is_arithmetic/value.cc:
	Likewise.
	* testsuite/tr1/4_metaprogramming/is_compound/value.cc:
	Likewise.
	* testsuite/tr1/4_metaprogramming/is_floating_point/value.cc:
	Likewise.
	* testsuite/tr1/4_metaprogramming/is_fundamental/value.cc:
	Likewise.
	* testsuite/tr1/4_metaprogramming/is_integral/value.cc:
	Likewise.
	* testsuite/tr1/4_metaprogramming/is_signed/value.cc: Likewise.
	* testsuite/tr1/4_metaprogramming/is_unsigned/value.cc:
	Likewise.
	* testsuite/tr1/4_metaprogramming/is_void/value.cc: Likewise.
	* testsuite/tr1/6_containers/hash/24799.cc: Likewise.
2021-10-09 00:57:50 +01:00
Jonathan Wakely
cfeff094e6 libstdc++: Move test that depends on wchar_t I/O to wchar_t sub-directory
This fixes a FAIL when --disable-wchar_t is used.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_filebuf/close/81256.cc: Moved to...
	* testsuite/27_io/basic_filebuf/close/wchar_t/81256.cc: ...here.
2021-10-09 00:57:48 +01:00
Jonathan Wakely
43e2a44182 libstdc++: Add missing _GLIBCXX_USE_WCHAR_T checks in testsuite
These tests fail for a --disable-wchar_t build.

libstdc++-v3/ChangeLog:

	* testsuite/22_locale/conversions/buffer/1.cc: Check
	_GLIBCXX_USE_WCHAR_T.
	* testsuite/22_locale/conversions/buffer/3.cc: Likewise. Add
	test using char16_t.
	* testsuite/22_locale/conversions/string/1.cc: Check
	_GLIBCXX_USE_WCHAR_T.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/native/alloc.cc: Likewise.
	* testsuite/27_io/filesystem/path/native/string-char8_t.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/native/string.cc: Likewise.
	* testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/generic/generic_string.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/native/alloc.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/native/string-char8_t.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/native/string.cc:
	Likewise.
2021-10-09 00:57:48 +01:00
Jonathan Wakely
29a9de9b40 libstdc++: Replace uses of _GLIBCXX_USE_INT128 in testsuite
Since r12-435 the _GLIBCXX_USE_INT128 macro is never defined, so all
uses of it in the testsuite are wrong. The tests should be checking
__SIZEOF_INT128__ instead.

Also add some tests for an INT_3 type, which were missing.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/numeric_limits/40856.cc: Replace use of
	_GLIBCXX_USE_INT128.
	* testsuite/18_support/numeric_limits/dr559.cc: Likewise.
	* testsuite/18_support/numeric_limits/lowest.cc: Likewise.
	* testsuite/18_support/numeric_limits/max_digits10.cc: Likewise.
	* testsuite/20_util/is_floating_point/value.cc: Likewise.
	* testsuite/20_util/is_integral/value.cc: Likewise.
	* testsuite/20_util/is_signed/value.cc: Likewise.
	* testsuite/20_util/is_unsigned/value.cc: Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs-1.cc:
	Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs-2.cc:
	Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs-1.cc:
	Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs-2.cc:
	Likewise.
	* testsuite/20_util/type_identity/requirements/typedefs.cc:
	Likewise.
	* testsuite/26_numerics/bit/bit.count/countl_one.cc: Likewise.
	* testsuite/26_numerics/bit/bit.count/countl_zero.cc: Likewise.
	* testsuite/26_numerics/bit/bit.count/countr_one.cc: Likewise.
	* testsuite/26_numerics/bit/bit.count/countr_zero.cc: Likewise.
	* testsuite/26_numerics/bit/bit.count/popcount.cc: Likewise.
	* testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc: Likewise.
	* testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc: Likewise.
	* testsuite/26_numerics/bit/bit.pow.two/bit_width.cc: Likewise.
	* testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc:
	Likewise.
	* testsuite/26_numerics/bit/bit.rotate/rotl.cc: Likewise.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/bit/bit.rotate/rotr.cc:
	* testsuite/util/testsuite_common_types.h:
2021-10-09 00:57:48 +01:00
Jonathan Wakely
d87105d697 libstdc++: Access std::pair members without tuple-like helpers
This avoids the tuple-like API for std::pair in the unordered
containers, removing some overly generic code.

The _Select1st projection can figure out the member types of a std::pair
without using decltype(std::get<0>(...)).

We don't need _Select2nd because it's only needed in
_NodeBuilder::_S_build, and that can just access the .second member of
the pair directly. The return type of that function doesn't need to be
deduced by decltype, we can just expose the __node_type typedef of the
node generator.

libstdc++-v3/ChangeLog:

	* include/bits/hashtable_policy.h (_Select1st): Replace use of
	std::get.
	(_Select2nd): Remove.
	(_NodeBuilder::_S_build): Use _NodeGenerator::__node_type
	typedef instead of deducing it. Remove unnecessary piecewise
	construction.
	(_ReuseOrAllocNode): Make __node_type public.
	(_Map_base): Adjust partial specialization to be able to extract
	the mapped_type without using tuple_element.
	(_Map_base::at): Define inline
	* testsuite/23_containers/unordered_map/requirements/53339.cc:
	Remove XFAIL.
	* testsuite/23_containers/unordered_multimap/requirements/53339.cc:
	Likewise.
2021-10-09 00:57:47 +01:00
Jonathan Wakely
fcc13d6fc3 libstdc++: Implement ostream insertion for chrono::duration
This is a missing piece of the C++20 <chrono> header.

It would be good to move the code into the compiled library, so that we
don't need <sstream> in <chrono>. It could also use spanstream in C++20,
to avoid memory allocations. That can be changed at a later date.

libstdc++-v3/ChangeLog:

	* include/std/chrono (__detail::__units_suffix_misc): New
	helper function.
	(__detail::__units_suffix): Likewise.
	(chrono::operator<<(basic_ostream&, const duration&)): Define.
	* testsuite/20_util/duration/io.cc: New test.
2021-10-08 12:19:19 +01:00
Jonathan Wakely
881d1689a4 libstdc++: Implement std::move_only_function for C++23 (P0288R9)
libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add new headers.
	* include/Makefile.in: Regenerate.
	* include/std/functional: Include <bits/move_only_function.h>.
	* include/std/version (__cpp_lib_move_only_function): Define.
	* include/bits/mofunc_impl.h: New file.
	* include/bits/move_only_function.h: New file.
	* testsuite/20_util/move_only_function/call.cc: New test.
	* testsuite/20_util/move_only_function/cons.cc: New test.
	* testsuite/20_util/move_only_function/move.cc: New test.
	* testsuite/20_util/move_only_function/version.cc: New test.
2021-10-06 20:12:01 +01:00
Jonathan Wakely
1f51e9af7b libstdc++: Ensure std::span and std::string_view are trivially copyable (P2251R1)
The recently approved P2251R1 paper requires these types to be trivially
copyable. They always have been in libstdc++, but add tests to check it.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string_view/requirements/trivially_copyable.cc:
	New test.
	* testsuite/23_containers/span/trivially_copyable.cc: New test.
2021-10-05 16:47:30 +01:00
Jonathan Wakely
824e085573 libstdc++: Add test for std::cmp_greater
This was omitted from the commit that added these comparisons.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/integer_comparisons/greater.cc: New test.
2021-10-05 15:56:55 +01:00
Jonathan Wakely
313193edfc libstdc++: Improve test for printing volatile pointers
libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_ostream/inserters_other/char/volatile_ptr.cc:
	Check result matches non-volatile pointer.
2021-10-05 15:56:55 +01:00
Jonathan Wakely
7646847df7 libstdc++: Fix testcase for newly-implemented C++20 semantics [PR102535]
libstdc++-v3/ChangeLog:

	PR c++/102535
	* testsuite/20_util/is_trivially_constructible/value.cc: Adjust
	expected value for C++20.
2021-10-05 09:35:47 +01:00
Jonathan Wakely
96955a82f0 libstdc++: Support printing volatile pointers (P1147R1)
To avoid needing to export a new symbol from the library (for now) the
new member function uses __attribute__((always_inline)).

libstdc++-v3/ChangeLog:

	* include/std/ostream (operator<<(const volatile void*)):
	Add new overload, as per P1147R1.
	* testsuite/27_io/basic_ostream/inserters_other/char/volatile_ptr.cc:
	New test.
2021-10-05 09:35:47 +01:00
Jonathan Wakely
9e136807c5 libstdc++: Update __cpp_lib_adaptor_iterator_pair_constructor value
I started implementing this feature before it was voted into the C++ WP,
and forgot to update the feature test macro after it was approved.

This defines it to the correct value, as specified in the C++23 draft.

libstdc++-v3/ChangeLog:

	* include/bits/stl_queue.h
	(__cpp_lib_adaptor_iterator_pair_constructor): Set to correct
	value.
	* include/bits/stl_stack.h
	(__cpp_lib_adaptor_iterator_pair_constructor): Likewise.
	* include/std/version
	(__cpp_lib_adaptor_iterator_pair_constructor): Likewise.
	* testsuite/23_containers/queue/cons_from_iters.cc: Update
	expected value.
	* testsuite/23_containers/stack/cons_from_iters.cc: Likewise.
2021-10-05 09:35:46 +01:00
Jonathan Wakely
22d34a2a50 libstdc++: Implement P1518R2 for container deduction guides
This implements the C++23 P1518R2 proposal "Stop overconstraining
allocators in container deduction guides" as a fix for C++17 and C++20
too.

The changes allow class template argument deduction to ignore the type
of a constructor argument that initializes an allocator_type parameter
if the type should be deducible only from the other arguments. So for
the constructor vector(const vector&, const allocator_type&) only the
first argument is used for deduction, allowing the second argument to be
anything that is implicitly convertible to argument_type. Previously
deduction would fail or an ill-formed type would be deduced if the
second argument wasn't of type allocator_type.

The unordered containers do not need changes, because their
allocator-extended constructors use the allocator_type alias, which
comes from the dependent base class so is already a non-deduced context.

libstdc++-v3/ChangeLog:

	* include/bits/forward_list.h (forward_list): Use non-deduced
	context for allocator parameter of allocator-extended copy and
	move constructors.
	* include/bits/stl_bvector.h (vector<bool>): Likewise.
	* include/bits/stl_deque.h (deque): Likewise.
	* include/bits/stl_list.h (list): Likewise.
	* include/bits/stl_map.h (map): Likewise.
	* include/bits/stl_multimap.h (multimap): Likewise.
	* include/bits/stl_multiset.h (multiset): Likewise.
	* include/bits/stl_set.h (set): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.
	* include/bits/stl_queue.h (queue, priority_queue): Do not
	constrain Allocator template parameter of deduction guides that
	have a Container parameter.
	* include/bits/stl_stack.h (stack): Likewise.
	* include/debug/deque (__gnu_debug::deque): Use non-deduced
	context for allocator parameter of allocator-extended copy and
	move constructors.
	* include/debug/list (__gnu_debug::list): Likewise.
	* include/debug/map.h (__gnu_debug::map): Likewise.
	* include/debug/multimap.h (__gnu_debug::multimap): Likewise.
	* include/debug/multiset.h (__gnu_debug::multiset): Likewise.
	* include/debug/set.h (__gnu_debug::set): Likewise.
	* include/debug/vector (__gnu_debug::vector): Likewise.
	* testsuite/23_containers/deque/cons/deduction.cc: Test class
	template argument deduction with non-deduced allocator
	arguments.
	* testsuite/23_containers/forward_list/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/list/cons/deduction.cc: Likewise.
	* testsuite/23_containers/map/cons/deduction.cc: Likewise.
	* testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
	* testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
	* testsuite/23_containers/priority_queue/deduction.cc: Likewise.
	* testsuite/23_containers/queue/deduction.cc: Likewise.
	* testsuite/23_containers/set/cons/deduction.cc: Likewise.
	* testsuite/23_containers/stack/deduction.cc: Likewise.
	* testsuite/23_containers/unordered_map/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/vector/cons/deduction.cc: Likewise.
2021-10-04 15:23:28 +01:00
Jonathan Wakely
cf876562c5 libstdc++: Disable std::string{,_view} construction from nullptr (P2166R1)
Implement this C++23 feature. Because construction from a null pointer
is undefined, we can implement it for C++11 and up, turning undefined
behaviour into a compilation error.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (basic_string(nullptr_t)): Define
	as deleted.
	(operator=(nullptr_t)): Likewise.
	* include/bits/cow_string.h (basic_string(nullptr_t)): Likewise.
	(operator=(nullptr_t)): Likewise.
	* include/std/string_view (basic_string_view(nullptr_t)):
	Likewise.
	* testsuite/21_strings/basic_string/cons/char/nullptr.cc: New test.
	* testsuite/21_strings/basic_string_view/cons/char/nonnull.cc:
	Change dg-warning to dg-error.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/nonnull.cc:
	Likewise.
2021-10-04 15:23:28 +01:00
Jonathan Wakely
ff7793bea4 libstdc++: Allow stateful allocators in std::list::sort [PR 66742]
The temporary lists used by std::list::sort are default constructed,
which means they use default constructed allocators. The sort operation
is defined in terms of merge and splice operations, which have undefined
behaviour (and abort) if the allocators do not compare equal. This means
it is not possible to sort a list that uses an allocator that compares
unequal to an default constructed allocator.

The solution is to avoid using temporary std::list objects at all. We do
not need to be able to allocate memory because no nodes are allocated,
only spliced from one list to another. That means the temporary lists
don't need an allocator at all, so whether it would compare equal
doesn't matter.

Instead of temporary std::list objects, we can just use a collection of
_List_node_base objects that nodes can be spliced onto as needed. Those
objects are wrapped in a _Scratch_list type that implements the splicing
and merging operations used by list::sort.

We also don't need to update the list size during the sort, because
sorting doesn't alter the number of nodes. Although we move nodes in and
out of the scratch lists, at the end of the function all nodes are back
in the original std::list and the scratch lists are empty.  So for the
cxx11 ABI we can avoid the _M_size modifications usually done when
splicing nodes.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/66742
	* include/bits/list.tcc (list::sort()): Use _Scratch_list
	objects for splicing and merging.
	(list::sort(StrictWeakOrdering)): Likewise.
	* include/bits/stl_list.h (__detail::_Scratch_list): New type.
	* src/c++98/list.cc (_List_node_base::_M_transfer): Add
	assertion for --enable-libstdcxx-debug library.
	* testsuite/23_containers/list/operations/66742.cc: New test.
2021-10-01 20:36:56 +01:00
Jonathan Wakely
34e9407b3b libstdc++: Make std::jthread support pointers to member functions [PR 100612]
This adds a non-standard extension to support initializing a
std::jthread with a pointer to a member function that expects a
stop_token to be added to the arguments. That use case is not supported
by C++20, because the stop_token would get added as the first argument,
which is where the object argument needs to be to invoke a pointer to
member function.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/100612
	* include/std/thread (__pmf_expects_stop_token): New variable
	template to detect a pointer to member function that needs a
	stop_token to be added to the arguments.
	(jthread::__S_create): Use __pmf_expects_stop_token.
	(jthread::__S_create_pmf): New function.
	* testsuite/30_threads/jthread/100612.cc: New test.
2021-10-01 20:36:55 +01:00
Jonathan Wakely
b7e8fb5e48 libstdc++: Add container adaptor constructors taking iterators (P1425R4)
This adds a feature that was recently added to the C++23 working draft.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/stl_queue.h
	(__cpp_lib_adaptor_iterator_pair_constructor): Define for C++23, as
	per P1425R4.
	(queue(InputIterator, InputIterator)): Likewise.
	(queue(InputIterator, InputIterator, const Alloc&)): Likewise.
	* include/bits/stl_stack.h
	(__cpp_lib_adaptor_iterator_pair_constructor): Likewise.
	(stack(InputIterator, InputIterator)): Likewise.
	(stack(InputIterator, InputIterator, const Alloc&)): Likewise.
	* include/std/version (__cpp_lib_adaptor_iterator_pair_constructor):
	Define.
	* testsuite/23_containers/queue/cons_from_iters.cc: New test.
	* testsuite/23_containers/stack/cons_from_iters.cc: New test.
2021-10-01 20:36:55 +01:00
Jonathan Wakely
6ccffeb56b libstdc++: Implement LWG 3506 for std::priority_queue
The LWG 3506 issue ads allocator-extended versions of the constructors
that take iterator arguments.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/stl_queue.h (priority_queue): Add
	allocator-extended overloads for constructors taking iterator.
	* testsuite/23_containers/priority_queue/lwg3506.cc: New test.
2021-10-01 20:36:55 +01:00
Jonathan Wakely
e79bde6ada libstdc++: Implement LWG 3529 for std::priority_queue
The LWG 3529 issue changes to use two overloads instead of one with a
default argument, so that the sequence can be initialized directly with
the iterator range when no sequence argument is provided.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/stl_queue.h (priority_queue): Construct sequence
	from iterators when no sequence argument is present (LWG 3529).
	* testsuite/23_containers/priority_queue/lwg3529.cc: New test.
2021-10-01 20:36:55 +01:00
Jonathan Wakely
e5c093e515 libstdc++: Implement LWG 3522 for std::priority_queue
The LWG 3522 issue constrains all constructors of container adaptors
that have InputIterator parameters.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/stl_queue.h (priority_queue): Constrain
	constructors with InputIterator parameters (LWG 3522).
	* testsuite/23_containers/priority_queue/lwg3522.cc: New test.
2021-10-01 20:36:55 +01:00
Jonathan Wakely
20751fad19 libstdc++: Implement LWG 3392 for std::ranges::distance
libstdc++-v3/ChangeLog:

	* include/bits/ranges_base.h (ranges::distance): Split overload
	into two (LWG 3392).
	* testsuite/24_iterators/range_operations/lwg3392.cc: New test.
2021-10-01 20:36:54 +01:00
Jonathan Wakely
9b790acc22 libstdc++: Remove unary_function base classes from std::thread tests
std::thread does not care if a function object is adaptable, so there is
no need to derive from the deprecated std::unary_function class in these
tests.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/30_threads/thread/cons/3.cc: Remove derivation from
	std::unary_function.
	* testsuite/30_threads/thread/cons/4.cc: Likewise.
	* testsuite/30_threads/thread/cons/5.cc: Likewise.
2021-10-01 20:36:54 +01:00
Jonathan Wakely
e3869a48fc libstdc++: Remove useless base classes in pb_db tests
These function objects do not need to be adaptable, so stop deriving
from deprecated classes. Also the 'inline' keyword is redundant on
member functions defined in the class body.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/ext/pb_ds/example/basic_multimap.cc: Remove
	unnecesary derivation from std::unary_function.
	* testsuite/ext/pb_ds/example/erase_if.cc: Likewise.
	* testsuite/ext/pb_ds/example/hash_illegal_resize.cc: Likewise.
	* testsuite/ext/pb_ds/example/hash_initial_size.cc: Likewise.
	* testsuite/ext/pb_ds/example/hash_load_set_change.cc: Likewise.
	* testsuite/ext/pb_ds/example/hash_mod.cc: Likewise.
	* testsuite/ext/pb_ds/example/hash_resize.cc: Likewise.
	* testsuite/ext/pb_ds/example/hash_shift_mask.cc: Likewise.
	* testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc:
	Likewise.
	* testsuite/ext/pb_ds/example/ranged_hash.cc: Likewise.
	* testsuite/ext/pb_ds/example/store_hash.cc: Likewise.
2021-10-01 20:36:54 +01:00
Jonathan Wakely
59ffa3e3db libstdc++: Avoid unconditional use of errc::not_supported [PR 99327]
The errc::not_supported constant is only defined if ENOTSUP is defined,
which is not true for all targets. Many uses of errc::not_supported in
the filesystem library do not actually match the intended meaning of
ENOTSUP described by POSIX. They should be using ENOSYS instead
(i.e. errc::function_not_supported).

This change ensures that appropriate error codes are used by the
filesystem library. The remaining uses of errc::not_supported are
replaced with a call to a new helper function so that an alternative
value will be used on targets that don't support errc::not_supported.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/99327
	* src/filesystem/ops-common.h (__unsupported): New function to
	return a suitable error code for missing functionality.
	(posix::off_t): New typedef.
	(posix::*): Set errno to ENOSYS instead of ENOTSUP for no-op
	fallback implementations.
	(do_copy_file): Replace uses of errc::not_supported.
	* src/c++17/fs_ops.cc (fs::copy, fs::copy_file, create_dir)
	(fs::create_directory, fs::create_directory_symlink)
	(fs::create_hard_link, fs::create_symlink, fs::current_path)
	(fs::equivalent, do_stat, fs::file_size, fs::hard_link_count)
	(fs::last_write_time, fs::permissions, fs::read_symlink):
	Replace uses of errc::not_supported.
	(fs::resize_file): Qualify off_t.
	* src/filesystem/ops.cc (fs::copy, fs::copy_file, create_dir)
	(fs::create_directory, fs::create_directory_symlink)
	(fs::create_hard_link, fs::create_symlink, fs::current_path)
	(fs::equivalent, do_stat, fs::file_size, fs::last_write_time)
	(fs::permissions, fs::read_symlink, fs::system_complete):
	Replace uses of errc::not_supported.
	(fs::resize_file): Qualify off_t and enable unconditionally.
	* testsuite/19_diagnostics/system_error/cons-1.cc: Likewise.
2021-10-01 20:34:50 +01:00
Jonathan Wakely
c46ecb0112 libstdc++: Allow visiting inherited variants [PR 90943]
Implement the changes from P2162R2 (as a DR for C++17).

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/90943
	* include/std/variant (__cpp_lib_variant): Update value.
	(__detail::__variant::__as): New helpers implementing the
	as-variant exposition-only function templates.
	(visit, visit<R>): Use __as to upcast the variant parameters.
	* include/std/version (__cpp_lib_variant): Update value.
	* testsuite/20_util/variant/visit_inherited.cc: New test.
2021-10-01 20:34:48 +01:00
Jonathan Wakely
d335d73889 libstdc++: Use conditional noexcept in std::reverse_iterator [PR 94418]
This adds a noexcept-specifier to each constructor and assignment
operator of std::reverse_iterator so that they are noexcept when the
corresponding operation on the underlying iterator is noexcept.

The std::reverse_iterator class template already requires that the
operations on the underlying type are valid, so we don't need to use the
std::is_nothrow_xxx traits to protect against errors when the expression
isn't even valid. We can just use a noexcept operator to test if the
expression can throw, without the overhead of redundantly checking if
the initialization/assignment would be valid.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/94418
	* include/bits/stl_iterator.h (reverse_iterator): Use
	conditional noexcept on constructors and assignment operators.
	* testsuite/24_iterators/reverse_iterator/noexcept.cc: New test.
2021-10-01 20:34:46 +01:00
Jonathan Wakely
94311bf347 libstdc++: Add missing header to test
We need to include <iterator> (or one of the containers) to get a
definition for std::begin.

libstdc++-v3/ChangeLog:

	* testsuite/25_algorithms/is_permutation/2.cc: Include <iterator>.
2021-10-01 15:04:02 +01:00
Jonathan Wakely
c67339d126 libstdc++: Fix _ForwardIteratorConcept for __gnu_debug::vector<bool>
The recent changes to the _GLIBCXX_CONCEPT_CHECKS checks for forward
iterators don't work for vector<bool> iterators in debug mode, because
the _Safe_iterator specializations don't match the special cases I added
for _Bit_iterator and _Bit_const_iterator.

This refactors the _ForwardIteratorReferenceConcept class template to
identify vector<bool> iterators using a new trait, which also works for
debug iterators.

libstdc++-v3/ChangeLog:

	* include/bits/boost_concept_check.h (_Is_vector_bool_iterator):
	New trait to identify vector<bool> iterators, including debug
	ones.
	(_ForwardIteratorReferenceConcept): Add default template
	argument using _Is_vector_bool_iterator and use it in partial
	specialization for the vector<bool> cases.
	(_Mutable_ForwardIteratorReferenceConcept): Likewise.
	* testsuite/24_iterators/operations/prev_neg.cc: Adjust dg-error
	line number.
2021-10-01 15:04:02 +01:00
Jonathan Wakely
f38cd3bdb4 libstdc++: Implement std::regex_constants::multiline (LWG 2503)
This implements LWG 2503, which allows ^ and $ to match line terminator
characters, rather than only matching the beginning and end of the
entire input. The multiline option is only valid for ECMAScript, but
for other grammars we ignore it rather than throwing an exception.

This is related to PR libstdc++/102480, which incorrectly said that
ECMAscript should match the beginning of a line when match_prev_avail
is used. I think that's only supposed to happen when multiline is used.

The new regex_constants::multiline and basic_regex::multiline constants
are not defined for strict -std=c++11 and -std=c++14 modes, but
regex_constants::__multiline is always defined, so that the
implementation can use it internally.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex.h (basic_regex::multiline): Define constant
	for C++17.
	* include/bits/regex_constants.h (regex_constants::multiline):
	Define constant for C++17.
	(regex_constants::__multiline): Define duplicate constant for
	internal use in C++11 and C++14.
	* include/bits/regex_executor.h (_Executor::_M_match_multiline()):
	New member function.
	(_Executor::_M_is_line_terminator(_CharT)): New member function.
	(_Executor::_M_at_begin(), _Executor::_M_at_end()): Use new
	member functions to support multiline matches.
	* testsuite/28_regex/algorithms/regex_match/multiline.cc: New test.
2021-09-29 13:48:19 +01:00
Jonathan Wakely
9ca4c42a3b libstdc++: Check for invalid syntax_option_type values in <regex>
The standard says that it is invalid for more than one grammar element
to be set in a value of type regex_constants::syntax_option_type. This
adds a check in the regex compiler andthrows an exception if an invalid
value is used.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex_compiler.h (_Compiler::_S_validate): New
	function.
	* include/bits/regex_compiler.tcc (_Compiler::_Compiler): Use
	_S_validate to check flags.
	* include/bits/regex_error.h (_S_grammar): New error code for
	internal use.
	* testsuite/28_regex/basic_regex/ctors/grammar.cc: New test.
2021-09-29 13:48:15 +01:00
Jonathan Wakely
b701e1f8f6 libstdc++: std::basic_regex should treat '\0' as an ordinary char [PR84110]
When the input sequence contains a _CharT(0) character, the strchr call
in _Scanner<_CharT>::_M_scan_normal() will search for '\0' and so return
a pointer to the terminating null at the end of the string. This makes
the scanner think it's found a special character. Because it doesn't
match any of the actual special characters, we fall off the end of the
function (or assert in debug mode).

We should check for a null character explicitly and either treat it as
an ordinary character (for the ECMAScript grammar) or an error (for all
others). I'm not 100% sure that's right, but it seems consistent with
the POSIX RE rules where a '\0' means the end of the regex pattern or
the end of the sequence being matched.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/84110
	* include/bits/regex_error.h (regex_constants::_S_null): New
	error code for internal use.
	* include/bits/regex_scanner.tcc (_Scanner::_M_scan_normal()):
	Check for null character.
	* testsuite/28_regex/basic_regex/84110.cc: New test.
2021-09-29 13:48:11 +01:00
Jonathan Wakely
b59be1adba libstdc++: Simplify std::basic_regex construction and assignment
Introduce a new _M_compile function which does the common work needed by
all constructors and assignment. Call that directly to avoid multiple
levels of constructor delegation or calls to basic_regex::assign
overloads.

For assignment, there is no need to construct a std::basic_string if we
already have a contiguous sequence of the correct character type, and no
need to construct a temporary basic_regex when assigning from an
existing basic_regex.

Also define the copy and move assignment operators as defaulted, which
does the right thing without constructing a temporary and swapping it.
Copying or moving the shared_ptr member cannot fail, so they can be
noexcept. The assign(const basic_regex&) and assign(basic_regex&&)
member can then be defined in terms of copy or move assignment.

The new _M_compile function takes pointer arguments, so the caller has
to convert arbitrary iterator ranges into a contiguous sequence of
characters. With that simplification, the __compile_nfa helpers are not
needed and can be removed.

This also fixes a bug where construction from a contiguous sequence with
the wrong character type would fail to compile, rather than converting
the elements to the regex character type.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/regex.h (__detail::__is_contiguous_iter): Move
	here from <bits/regex_compiler.h>.
	(basic_regex::_M_compile): New function to compile an NFA from
	a regular expression string.
	(basic_regex::basic_regex): Use _M_compile instead of delegating
	to other constructors.
	(basic_regex::operator=(const basic_regex&)): Define as
	defaulted.
	(basic_regex::operator=(initializer_list<C>)): Use _M_compile.
	(basic_regex::assign(const basic_regex&)): Use copy assignment.
	(basic_regex::assign(basic_regex&&)): Use move assignment.
	(basic_regex::assign(const C*, flag_type)): Use _M_compile
	instead of constructing a temporary string.
	(basic_regex::assign(const C*, size_t, flag_type)): Likewise.
	(basic_regex::assign(const basic_string<C,T,A>&, flag_type)):
	Use _M_compile instead of constructing a temporary basic_regex.
	(basic_regex::assign(InputIter, InputIter, flag_type)): Avoid
	constructing a temporary string for contiguous iterators of the
	right value type.
	* include/bits/regex_compiler.h (__is_contiguous_iter): Move to
	<bits/regex.h>.
	(__enable_if_contiguous_iter, __disable_if_contiguous_iter)
	(__compile_nfa): Remove.
	* testsuite/28_regex/basic_regex/assign/exception_safety.cc: New
	test.
	* testsuite/28_regex/basic_regex/ctors/char/other.cc: New test.
2021-09-29 13:48:02 +01:00
François Dumont
26c09ae12d libstdc++: Fix 48631_neg test in _GLIBCXX_INLINE_VERSION mode
libstdc++-v3/ChangeLog:

	* testsuite/20_util/default_delete/48631_neg.cc: Adapt dg-prune-output message
	to also match message with '__8' in it.
2021-09-28 22:09:48 +02:00
Jonathan Wakely
07fbdd7bda libstdc++: Skip container adaptor tests that fail concept checks
As an extension, our container adaptors SFINAE away the default
constructor if the adapted sequence container is not default
constructible. When _GLIBCXX_CONCEPT_CHECKS is defined we enforce that
the sequence is default constructible, so the tests for the extension
fail. This disables the relevant parts of the tests.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1.cc:
	Do not check non-default constructible sequences when
	_GLIBCXX_CONCEPT_CHECKS is defined.
	* testsuite/23_containers/priority_queue/requirements/explicit_instantiation/1_c++98.cc:
	Likewise.
	* testsuite/23_containers/queue/requirements/explicit_instantiation/1.cc:
	Likewise.
	* testsuite/23_containers/queue/requirements/explicit_instantiation/1_c++98.cc:
	Likewise.
	* testsuite/23_containers/stack/requirements/explicit_instantiation/1.cc:
	Likewise.
	* testsuite/23_containers/stack/requirements/explicit_instantiation/1_c++98.cc:
	Likewise.
2021-09-28 20:22:51 +01:00
Jonathan Wakely
b701f46ea6 libstdc++: Skip tests that fail with _GLIBCXX_CONCEPT_CHECKS
The extension that allows implicitly rebinding a container's allocator
is not allowed when _GLIBCXX_CONCEPT_CHECKS is defined, so skip the
tests for that extension.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/deque/requirements/explicit_instantiation/3.cc:
	Do not test implicit allocator rebinding when _GLIBCXX_CONCEPT_CHECKS
	is defined.
	* testsuite/23_containers/forward_list/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/map/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/map/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/5.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/vector/ext_pointer/explicit_instantiation/3.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/explicit_instantiation/3.cc:
	Likewise.
2021-09-28 20:22:51 +01:00
Jonathan Wakely
afffc96a52 libstdc++: Fix concept checks for iterators
This adds some additional checks the the C++98-style concept checks for
iterators, and removes some bogus checks for mutable iterators. Instead
of requiring that the result of dereferencing a mutable iterator is
assignable (which is a property of the value type, not required for the
iterator) check that the reference type is a non-const reference to the
value type.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/boost_concept_check.h (_ForwardIteratorConcept)
	(_BidirectionalIteratorConcept, _RandomAccessIteratorConcept):
	Check result types of iterator operations.
	(_Mutable_ForwardIteratorConcept): Check that iterator's
	reference type is a reference to its value type.
	(_Mutable_BidirectionalIteratorConcept): Do not require the
	value type to be assignable.
	(_Mutable_RandomAccessIteratorConcept): Likewise.
	* testsuite/24_iterators/operations/prev_neg.cc: Adjust dg-error
	line number.
2021-09-28 20:22:51 +01:00
Jonathan Wakely
5f1db7627f libstdc++: Improve types used as iterators in testsuite
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/25_algorithms/copy/34595.cc: Add missing operation
	for type used as an iterator.
	* testsuite/25_algorithms/unique_copy/check_type.cc: Likewise.
2021-09-28 20:22:51 +01:00
Jonathan Wakely
4000d722e6 libstdc++: Fix tests that use invalid types in ordered containers
Types used in ordered containers need to be comparable, or the container
needs to use a custom comparison function. These tests fail when
_GLIBCXX_CONCEPT_CHECKS is defined, because the element types aren't
comparable.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/20_util/is_nothrow_swappable/value.h: Use custom
	comparison function for priority_queue of type with no
	relational operators.
	* testsuite/20_util/is_swappable/value.h: Likewise.
	* testsuite/24_iterators/output/concept.cc: Add operator< to
	type used in set.
2021-09-28 20:22:51 +01:00
Jonathan Wakely
82626be2d6 libstdc++: Specialize std::pointer_traits<__normal_iterator<I,C>>
This allows std::__to_address to be used with __normal_iterator in
C++11/14/17 modes. Without the partial specialization the deduced
pointer_traits::element_type is incorrect, and so the return type of
__to_address is wrong.

A similar partial specialization is probably needed for
__gnu_debug::_Safe_iterator.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h (pointer_traits): Define partial
	specialization for __normal_iterator.
	* testsuite/24_iterators/normal_iterator/to_address.cc: New test.
2021-09-28 20:22:50 +01:00
Jonathan Wakely
a11052d98d libstdc++: Improve std::forward static assert message
The previous message told you something was wrong, but not why it
happened or why it's bad. This changes it to explain that the function
is being misused.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/move.h (forward(remove_reference_t<T>&&)):
	Improve text of static_assert.
	* testsuite/20_util/forward/c_neg.cc: Adjust dg-error.
	* testsuite/20_util/forward/f_neg.cc: Likewise.
2021-09-28 17:30:05 +01:00
Jonathan Wakely
43358e91bd libstdc++: Remove c++20-specific dg-error directives in test
I added extra dg-error directives for C++20 to match the extra errors
caused by some of the call stack being constexpr in C++20. Since Jason's
changes to reduce those errors, those dg-error lines no longer match.
This removes them again.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc:
	Remove dg-error lines for C++20-only errors.
2021-09-23 16:07:39 +01:00
Jonathan Wakely
8fa90926e0 libstdc++: Disable PCH for test that depends on a macro being defined
This test tries to ensure that <system_error> can be included after
defining _XOPEN_SOURCE=600, which doesn't test anything if that header
is already included via the <bits/stdc++.h> PCH before the macro
definition. Disable PCH so that it behaves as intended.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/19_diagnostics/headers/system_error/93151.cc:
	Disable PCH.
2021-09-23 16:07:39 +01:00
Jonathan Wakely
477897451e libstdc++: Make std::system_category() recognize Windows error codes
The std::system_category error category should be used for
system-specific error codes, which means on Windows it should be used
for Windows error codes.  Currently that category assumes that the error
numbers it deals with are errno numbers, which means that
ERROR_ACCESS_DENIED (which has value 0x5) gets treated as whichever
errno number happens to have that value (EIO on mingw32-w64).

This adds a mapping from known Windows error codes to generic errno
ones. This means we correctly treat ERROR_ACCESS_DENIED as corresponding
to EACCES.

Also make std::system_category().message(int) return the right message
for Windows errors, by using FormatMessage instead of strerror. The
output of FormatMessage includes ".\r\n" at the end, so we strip that
off to allow the message to be used in contexts where that would be
problematic.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* src/c++11/system_error.cc (system_error_category) [_WIN32]:
	Map Windows error codes to generic POSIX error numbers. Use
	FormatMessage instead of strerror.
	* testsuite/19_diagnostics/error_category/system_category.cc:
	Adjust for new behaviour on Windows.
2021-09-23 16:07:39 +01:00
Jonathan Wakely
ce01e2e64c libstdc++: std::system_category should know meaning of zero [PR102425]
Although 0 is not an errno value, it should still be recognized as
corresponding to a value belonging to the generic_category().

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/102425
	* src/c++11/system_error.cc
	(system_error_category::default_error_condition): Add 0 to
	switch.
	* testsuite/19_diagnostics/error_category/102425.cc: New test.
2021-09-23 16:07:38 +01:00
Jonathan Wakely
1fa2c5a695 libstdc++: Fix last std::tuple constructor missing 'constexpr' [PR102270]
Also rename the test so it actually runs.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/102270
	* include/std/tuple (_Tuple_impl): Add constexpr to constructor
	missed in previous patch.
	* testsuite/20_util/tuple/cons/102270.C: Moved to...
	* testsuite/20_util/tuple/cons/102270.cc: ...here.
	* testsuite/util/testsuite_allocator.h (SimpleAllocator): Add
	constexpr to constructor so it can be used for C++20 tests.
2021-09-17 20:43:34 +01:00
Jonathan Wakely
749c31b345 libstdc++: Rename tests with incorrect extension
The libstdc++ testsuite only runs .cc files, so these two old tests have
never been run.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/valarray/dr630-3.C: Moved to...
	* testsuite/26_numerics/valarray/dr630-3.cc: ...here.
	* testsuite/27_io/basic_iostream/cons/16251.C: Moved to...
	* testsuite/27_io/basic_iostream/cons/16251.cc: ...here.
2021-09-17 12:40:41 +01:00
Jonathan Wakely
4337893306 libstdc++: Increase timeout factor for slow pb_ds tests
Compiling these tests still times out too often when running the
testsuite with more parallel jobs than there are available cores.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/ext/pb_ds/regression/tree_map_rand.cc: Increase
	timeout factor to 3.
	* testsuite/ext/pb_ds/regression/tree_set_rand.cc: Likewise.
2021-09-16 23:06:38 +01:00
Jonathan Wakely
734b2c2eed libstdc++: Add missing 'constexpr' to std::tuple [PR102270]
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/102270
	* include/std/tuple (_Head_base, _Tuple_impl): Add
	_GLIBCXX20_CONSTEXPR to allocator-extended constructors.
	(tuple<>::swap(tuple&)): Add _GLIBCXX20_CONSTEXPR.
	* testsuite/20_util/tuple/cons/102270.C: New test.
2021-09-16 23:06:31 +01:00
Thomas Rodgers
f9f1a6efaa libstdc++: Fix UB in atomic_ref/wait_notify.cc [PR101761]
Remove UB in atomic_ref/wait_notify test.

Signed-off-by: Thomas Rodgers <trodgers@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/101761
	* testsuite/29_atomics/atomic_ref/wait_notify.cc (test): Use
	va and vb as arguments to wait/notify, remove unused bb local.
2021-09-16 14:48:17 -07:00
Jonathan Wakely
7f8af6dc82 libstdc++: Use "test.invalid." for invalid hostname
This avoids test.invalid.some.domain being successfully resolved.

libstdc++-v3/ChangeLog:

	* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
	Fix invalid hostname to only match the .invalid TLD.
2021-09-10 15:10:21 +01:00
Jonathan Wakely
5b73abd1a5 libstdc++: Define std::invoke_r for C++23 (P2136R3)
We already supported this feature as std::__invoke<R>, for internal use.
This just adds a public version of it to <functional>.

Internal uses should continue to include <bits/invoke.h> and use
std::__invoke<R> so that they don't need to include all of <functional>.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/std/functional (invoke_r): Define.
	* include/std/version (__cpp_lib_invoke_r): Define.
	* testsuite/20_util/function_objects/invoke/version.cc: Check
	for __cpp_lib_invoke_r as well as __cpp_lib_invoke.
	* testsuite/20_util/function_objects/invoke/4.cc: New test.
2021-09-02 17:48:45 +01:00
Jonathan Wakely
ef7becc9c8 libstdc++: Add valid range checks to std::span constructors [PR98421]
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/98421
	* include/std/span (span(Iter, size_type), span(Iter, Iter)):
	Add valid range checks.
	* testsuite/23_containers/span/cons_1_assert_neg.cc: New test.
	* testsuite/23_containers/span/cons_2_assert_neg.cc: New test.
2021-08-31 19:13:55 +01:00
Jonathan Wakely
f63e86f797 libstdc++: Remove redundant noexcept-specifier on definitions
These destructors are noexcept anyway. I removed the redundant noexcept
from the error_category destructor's declaration in r0-123475, but
didn't remove it from the defaulted definition in system_error.cc. That
causes warnings if the library is built with Clang.

This removes the redundant noexcept from ~error_category and
~system_error and adds tests to ensure they really are noexcept.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* src/c++11/system_error.cc (error_category::~error_category()):
	Remove noexcept-specifier.
	(system_error::~system_error()): Likewise.
	* testsuite/19_diagnostics/error_category/noexcept.cc: New test.
	* testsuite/19_diagnostics/system_error/noexcept.cc: New test.
2021-08-31 17:36:12 +01:00
Jonathan Wakely
48b20d46f9 libstdc++: Fix ip::tcp::resolver test failure on Solaris
Solaris 11 does not have "http" in /etc/services, which causes this test
to fail. Try some other services until we find one that works.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
	Try other service if "http" fails.
2021-08-31 17:36:11 +01:00
Jonathan Wakely
69b09c5599 libstdc++: Fix 17_intro/names.cc failures on Solaris
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/17_intro/names.cc: Undefine some more names used
	by Solaris system headers.
2021-08-31 14:17:53 +01:00
Jason Merrill
8960a29b18 c++: limit instantiation with ill-formed class [PR96286]
I noticed that after the static_assert failures in lwg3466.cc, we got
various follow-on errors because we went ahead and tried to instantiate the
promise<T> member functions even after instantiating the class itself ran
into problems.  Interrupting instantiation of the class itself seems likely
to cause error-recovery problems, but preventing instantiation of member
functions seems strictly better for error-recovery.

This doesn't fix any of the specific testcases in PR96286, but addresses
part of that problem space.

	PR c++/96286

gcc/cp/ChangeLog:

	* cp-tree.h (struct lang_type): Add erroneous bit-field.
	(CLASSTYPE_ERRONEOUS): New.
	* pt.c (limit_bad_template_recursion): Check it.
	(instantiate_class_template_1): Set it.

libstdc++-v3/ChangeLog:

	* testsuite/30_threads/promise/requirements/lwg3466.cc:
	Remove dg-prune-outputs.

gcc/testsuite/ChangeLog:

	* g++.dg/template/access2.C: Split struct A.
2021-08-30 17:25:21 -04:00
Jonathan Wakely
d38d26be33 libstdc++: Avoid a move in std::function construction (LWG 2447)
This makes the std::function constructor use perfect forwarding, to
avoid an unnecessary move-construction of the target. This means we need
to rewrite the _Function_base::_Base_manager::_M_init_functor function
to use a forwarding reference, and so can reuse it for the clone
operation.

Also simplify the SFINAE constraints on the constructor, by combining
the !is_same_v<remove_cvref_t<F>, function> constraint into the
_Callable trait.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/std_function.h (_function_base::_Base_manager):
	Replace _M_init_functor with a function template using a
	forwarding reference, and a pair of _M_create function
	templates. Reuse _M_create for the clone operation.
	(function::_Decay_t): New alias template.
	(function::_Callable): Simplify by using _Decay.
	(function::function(F)): Change parameter to forwarding
	reference, as per LWG 2447. Add noexcept-specifier. Simplify
	constraints.
	(function::operator=(F&&)): Add noexcept-specifier.
	* testsuite/20_util/function/cons/lwg2774.cc: New test.
	* testsuite/20_util/function/cons/noexcept.cc: New test.
2021-08-27 00:12:54 +01:00
Jonathan Wakely
cd67d138ec libstdc++: Make Networking TS headers more portable [PR100285]
Add more preprocessor conditions to check for constants being defined
before using them, so that the Networking TS headers can be compiled on
a wider range of platforms.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/100285
	* configure.ac: Check for O_NONBLOCK.
	* configure: Regenerate.
	* include/experimental/internet: Include <ws2tcpip.h> for
	Windows.  Use preprocessor conditions around more constants.
	* include/experimental/socket: Use preprocessor conditions
	around more constants.
	* testsuite/experimental/net/internet/resolver/base.cc: Only use
	constants when the corresponding C macro is defined.
	* testsuite/experimental/net/socket/basic_socket.cc: Likewise.
	* testsuite/experimental/net/socket/socket_base.cc: Likewise.
	Make preprocessor checks more fine-grained.
2021-08-26 12:41:28 +01:00