17147 Commits

Author SHA1 Message Date
Jonathan Wakely
57a8b54cc4 libstdc++: Simplify std::shared_ptr internals
Now that we don't use the EBO we can flatten the _Sp_counted_deleter and
_Sp_counted_ptr_inplace layouts by removing their _Impl classes.

libstdc++-v3/ChangeLog:

	* include/bits/out_ptr.h (out_ptr_t::_Impl::~_Impl): Adjust
	access to shared_ptr internals.
	* include/bits/shared_ptr_base.h (_Sp_counted_deleter): Remove
	_Impl class and replace _M_impl with the data members it
	contained.
	(_Sp_counted_ptr_inplace): Likewise.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-05-06 15:14:00 +01:00
Jonathan Wakely
c30bf3aee7 libstdc++: Replace uses of EBO with [[no_unique_address]]
Clang 9 added support for [[__no_unique_address__]] and we don't support
Intel icc any longer, so we can remove the code in <tuple> that works
around the absence of that attribute. We can also address a FIXME in
<bits/shared_ptr_base.h> and replace uses of EBO with the attribute.

libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr_base.h (_Sp_ebo_helper): Simplify by
	using [[__no_unique_address__]] instead of EBO. Use the
	attribute unconditionally for the unstable ABI.
	(_Sp_counted_deleter::_Impl): Adjust uses of _Sp_ebo_helper.
	(_Sp_counted_ptr_inplace::_Impl): Likewise.
	* include/std/tuple (_Head_base): Remove implementation for
	compilers that don't support [[__no_unique_address__]]. Use the
	attribute unconditionally for the unstable ABI.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-05-06 15:14:00 +01:00
Tomasz Kamiński
9b076412e6 libstdc++: Format all contiguous ranges usign spoan.
We convert all contiguous ranges into span of the possibly-const qualified
_Tp (__format::__maybe_const<_Tp, _CharT>). The span object is const qualifed,
to trigger _M_format<const span<T>> specialization, that is already used by
formatter specialization for ranges.

This conversion is applied regardless if range is sized, and ranges::distance
to compute the size. Even for user-defined iterators, they will observe range
being iterated only once.

Finally, using raw pointers to iterate range during formatting guarantees,
that no stdio lock will be taken. In consequence it would be now possible
to enable_nonlocking_formatter_optimization for all contiguous ranges.

libstdc++-v3/ChangeLog:

	* include/std/format (range_formatter::format): Format all
	contiguous ranges as span<__format::__maybe_const<_Tp, _CharT>>.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-05-06 15:07:32 +02:00
Jonathan Wakely
5d225c5aa3 libstdc++: Remove non-concepts fallback for std::make_shared_for_overwrite
Clang 10 added support for concepts, so we no longer need to support
C++20 compilers that don't define __cpp_concepts.

libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr.h (_UnboundedArray, _BoundedArray)
	(_NotUnboundedArray): Remove fallback definition for C++20
	compilers that don't define __cpp_concepts.
	* include/bits/shared_ptr_base.h (_Sp_counted_ptr_inplace):
	Remove fallback declaration of _Sp_overwrite_tag partial
	specialization.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-05-06 13:18:14 +01:00
Tomasz Kamiński
c56ec55c79 libstdc++: Avoid double indirection in function_ref when possible
This implements the P3961R1: Less double indirection in function_ref.

This patch uses provision provided by the paper for implementations, and
expands the set of the compatible signatures to include ParamType&& and
ParamType, and by value return types that differs only in cv-qualifiers.
This follows the move_only_function approach from the r16-617-g708d40ff109c6e.
Futhermore the optimization is also applied when function_ref<Ret(Args...) const>
is constructed from function_ref<Ret(Args...)>, even if the underyling target
is be mutated by the call.

The implementations moves the _M_ptrs members to newly defined base class
__polyfunc::_Ref_base. This allows us to reuse existing __base_of and
__invoker_of accessor in the implementation (after befriending them).
The accessors functions are also now marked as constexpr. Furthermore,
_Ref_base default constructor initializes the _M_ptrs._M_obj to nullptr,
and _M_init function is transfered to it, making it instantiations
independent from callback signature.

To check signature compatiblity required by standard for assignment, new
__is_funcref_assignable function is used, and _ArgsSignature and _TargetQuals
member typedef are defined in function_ref. To avoid confusion between adjusted
and specified signature, _Signature typedef is removed from all wrappers, and
__is_invoker_convertible is updated to use _Invoker::_Signature instead.

Per SG-10 guidance __cpp_lib_function_ref feature test macro is updated to
202604, differntiating from P3948R1 paper accepted at the same time.

	PR libstdc++/119126

libstdc++-v3/ChangeLog:

	* include/bits/funcwrap.h : (__polyfunc::__invoker_of):
	Updated to use _Invoker::_Signature and mark as constexpr.
	(__polyfunc::_base_of): Mark as constexpr.
	(__std:::__is_function_ref_v, __polyfunc::_Ref_base)
	(__polyfunc::__is_funcref_assignable): Define.
	* include/bits/funcref_impl.h (std::function_ref): Add base class
	of type__polyfunc::_Ref_base. Befriend __invoker_of, __base_of,
	__is_invoker_convertible, __is_invoker_convertible.
	(function_ref::_Base): Define.
	(function_ref::_M_init, function_ref::_M_ptrs): Move to base class.
	(function_ref::function_ref(_Fn&&), function_ref::operator=): Handle
	specializations of function_ref with compatible signatures.
	(function_ref::function_ref): Init base class before _M_invoke
	consistently, and remove setting of _M_nullptr.
	* include/bits/cpyfunc_impl.h (copyable_function): Udpdated friend
	declarations.
	(copyable_function::_Signature): Remove.
	* include/bits/mofunc_impl.h (move_only_function): Udpdated friend
	declarations.
	(move_only_function::_Signature): Remove.
	* include/bits/version.def (function_ref): Bump to 202604.
	* include/bits/version.h: Regnerate.
	* testsuite/20_util/function_ref/cons.cc: Updated checked FTM value.
	* testsuite/20_util/function_ref/conv.cc: Updated test to illustrate
	that double indirection is avoided.
	* testsuite/20_util/function_ref/dangling.cc: Test for initializing
	from function_ref with compatible signature.
	* testsuite/20_util/function_ref/dangling_neg.cc: Test for
	initializing from function_ref with incompatible signature.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-05-06 13:22:01 +02:00
Jonathan Wakely
a6ffae6d7f libstdc++: Use hardware_destructive_interference_size in atomic.cc
This code was moved from a header into the library, so is no longer
affected by compiler options used when including the headers. We can
just use std::hardware_destructive_interference_size now, and remove the
comment.

libstdc++-v3/ChangeLog:

	* src/c++20/atomic.cc (__waitable_state::_S_align): Remove.
	(__waitable_state::_M_waiters, __waitable_state::_M_ver): Use
	std::hardware_destructive_interference_size for alignment.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-05-06 10:52:44 +01:00
Jonathan Wakely
d8cde7c085 libstdc++: Improve docs for range access functions [PR97001]
libstdc++-v3/ChangeLog:

	PR libstdc++/97001
	* include/bits/range_access.h: Improve Doxygen comments.
2026-05-06 09:29:46 +01:00
GCC Administrator
2cd9325e3e Daily bump. 2026-05-06 00:16:29 +00:00
Jonathan Wakely
8d287bd704 libstdc++: Fix experimental::__is_x86_pd() [PR124657]
libstdc++-v3/ChangeLog:

	PR libstdc++/124657
	* include/experimental/bits/simd_x86.h (__is_x86_pd): Fix macro
	names and refactor to reduce instantiations.
2026-05-05 19:15:28 +01:00
Jonathan Wakely
f95c05fe96 libstdc++: Fix mainpage.html link to Doxygen docs [PR109965]
Doxygen renamed the "Modules" documentation to "Topics" a few years ago
to avoid confusion with C++20 Modules:
https://github.com/doxygen/doxygen/issues/8772

This updates our internal link to 'modules.html' so that it refers to
'topics.html' instead.

libstdc++-v3/ChangeLog:

	PR libstdc++/109965
	* doc/doxygen/mainpage.html: Link to topics.html instead of
	modules.html
2026-05-05 11:13:28 +01:00
Jonathan Wakely
72fc51b1ac libstdc++: Make std::unique_ptr<void>::operator* SFINAE-friendly
This implements LWG 4324, "unique_ptr<void>::operator* is not
SFINAE-friendly", approved in Croydon, 2026.

The noexcept-specifier added to C++23 by LWG 2762 is ill-formed if the
pointer type cannot be dereferenced, which means that code which was
checking whether the function exists (e.g. in a SFINAE context) no
longer works. Such code was always questionable, because the function
body was ill-formed if the pointer isn't dereferenceable, so the SFINAE
check was probably giving the wrong answer, but it was possible to ask
the question. Since LWG 2762 just asking the question can produce an
error outside the immediate context, so operator* is no longer
SFINAE-friendly.

LWG 4324 adds a constraint to the function, so that it doesn't
participate in overload resolution if it would be ill-formed. That's
easy to implement for C++20 because we can just add a requires-clause.

For C++11/14/17 we can't constrain it easily, so just adjust the
noexcept-specifier so that it's not ill-formed. This still means you get
the wrong answer (i.e. it looks like unique_ptr<void>::operator* is
callable) but there's no error outside the immediate context. This
restores the original semantics before the LWG 2762 change, for better
or worse.

libstdc++-v3/ChangeLog:

	* include/bits/unique_ptr.h (unique_ptr::_Nothrow_deref): New
	helper for pre-C++20.
	(unique_ptr::operator*): Either constrain or use _Nothrow_deref.
	* testsuite/20_util/unique_ptr/lwg4324.cc: New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-05-05 10:02:11 +01:00
Tomasz Kamiński
108fdf003e libstdc++: Remove duplicated __mdspan::__is_constant_wrapper.
Replace it with std::__is_constant_wrapper_v from utility.

libstdc++-v3/ChangeLog:

	* include/std/mdspan: Replace eight spaces with tabs.
	(__mdspan::__is_constant_wrapper): Remove.
	(__mdspan::__acceptable_slice_type, __mdspan::__static_slice_extent)
	(__mdspan::__is_unit_stride_slice, __mdspan::__canonical_range_slice)
	(__mdspan::__check_inrange_index, __mdspan::__check_valid_index)
	(__mdspan::__check_valid_slice): Use std::__is_constant_wrapper_v.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-05-05 09:48:55 +02:00
GCC Administrator
71b75e9173 Daily bump. 2026-05-03 00:16:23 +00:00
Alexandre Oliva
dcc21c5517 testsuite: semaphore/try_acquire_until: reorder clock::now calls
Clock calls on VxWorks are slow, so the odds that the consecutive
calls of *clock::now() will yield a different result are not
negligible.  Reordering the calls avoids false positives.


for  libstdc++-v3/ChangeLog

	* testsuite/30_threads/semaphore/try_acquire_until.cc
	(test01): Reorder calls.
2026-05-02 03:28:07 -03:00
GCC Administrator
9f6ac583e4 Daily bump. 2026-05-02 00:16:28 +00:00
Jonathan Wakely
bbe8fff16e libstdc++: Tweak Doxygen comments for experimental simd
I noticed that Doxygen was not documenting the contents of
<experimental/simd> as part of namespace std, because it didn't know
about the _GLIBCXX_SIMD_BEGIN_NAMESPACE and _GLIBCXX_SIMD_END_NAMESPACE
macros which open and close namespace std::experimental::parallelism_v2.

After defining those macros in the Doxygen config, the Doxygen comments
in experimental/bits/simd.h were causing namespace std to be documented
as part of the Parallelism TS v2. That's because the preprocessed code
looks like:

/** @ingroup ts_simd
 * @{
 */
namespace std::experimental::inline parallelism_v2 {

This causes Doxygen to apply the @ingroup command to all three of
namespace std, namespace std::experimental, and namespace
std::experimental::parallelism_v2. I don't know if this is the intended
behaviour, but it doesn't seem useful so I've opened an issue about it:
https://github.com/doxygen/doxygen/issues/12114

To workaround this, we can move the _GLIBCXX_SIMD_BEGIN_NAMESPACE macro
before the @{ group and document it separately with a @namespace
comment. That makes the @ingroup only apply to the namespace named by
the @namespace command, not to its enclosing namespaces as well. Moving
the position of the BEGIN macro also fixes the nesting, as previously we
had @{ then BEGIN then @} then END. Now we have BEGIN @{ @} END which
seems preferable.

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (PREDEFINED): Add BEGIN/END macros for
	the <experimental/simd> namespace.
	* include/experimental/bits/simd.h: Move BEGIN macro before
	Doxygen @{ group.
2026-05-01 13:31:07 +01:00
Jonathan Wakely
59cf910a43 libstdc++: Suppress Doxygen docs for internals in <bits/locale_conv.h>
libstdc++-v3/ChangeLog:

	* include/bits/locale_conv.h: Prevent namespace __detail from
	being documented as part of the Locales topic.
2026-05-01 12:44:11 +01:00
Jonathan Wakely
8050bda5ec libstdc++: Improve Doxygen comments for <iterator> contents
Use markdown and suppress unwanted docs for internal helpers.

libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h: Prevent Doxygen from documenting
	namespace __detail as part of the Iterators topic.
	* include/bits/stl_iterator_base_funcs.h: Likewise. Also mark
	internal helpers as undocumented.
	(distance, advance): Improve Doxygen comments.
	* include/bits/stl_iterator_base_types.h (iterator): Use
	markdown in Doxygen comment. Add @deprecated.
	(iterator_traits): Improve wording of Doxygen comment.
2026-05-01 12:43:29 +01:00
Jonathan Wakely
0a2b9dc965 libstdc++: Do not assume URBG::result_type exists [PR121919]
The ranges::sample and ranges::shuffle algorithms are supposed to work
with types which model std::uniform_random_bit_generator, which means
they should not assume that G::result_type is present. That isn't needed
to satisfy the concept. Change the algorithms to use decltype(__g())
instead of using result_type.

This isn't sufficient to fix the bug though, because those algorithms
use std::uniform_int_distribution and that class template's operator()
overloads depend on the more restrictive uniform random bit generator
requirements, which do include the presence of a nested result_type
member.

We need to change std::uniform_int_distribution to also use decltype
instead of the nested result_type, even though the standard says that
std::uniform_int_distribution is allowed to assume that result_type
exists.

There's yet another problem, which is that a type that returns random
bool values can model the concept, but doesn't meet the named
requirements and can't be used with std::uniform_int_distribution. That
isn't addressed by this change.

libstdc++-v3/ChangeLog:

	PR libstdc++/121919
	* include/bits/ranges_algo.h (__sample_fn, __shuffle_fn): Use
	decltype(__g()) instead of remove_reference_t<_G>::result_type.
	* include/bits/uniform_int_dist.h
	(uniform_int_distribution::operator()): Use decltype(__urng())
	instead of _UniformRandomBitGenerator::result_type
	(uniform_int_distribution::__generate_impl): Likewise.
	* testsuite/25_algorithms/sample/121919.cc: New test.
	* testsuite/25_algorithms/shuffle/121919.cc: New test.

Reviewed-by: Nathan Myers <nmyers@redhat.com>
2026-05-01 12:18:56 +01:00
GCC Administrator
2a5b03d40e Daily bump. 2026-05-01 00:16:27 +00:00
Felix Morgner
d4ca6c0d87 libstdc++: Add <bits/binders.h> to freestanding headers [PR125112]
The <ranges> header was added to the freestanding headers in
r16-3575-g1a41e52d7ecb58 but bits/binders.h that it depends on was not
moved, making <ranges> unusable with --disable-libstdcxx-hosted.

libstdc++-v3/ChangeLog:

	PR libstdc++/125112
	* include/Makefile.am: Move bits/binders.h from bits_headers to
	bits_freestanding.
	* include/Makefile.in:
2026-04-30 21:40:06 +01:00
Tomasz Kamiński
a3a46ae220 libstdc++: Rework P0952 generate_cannonical tests.
This expands on the changes from test fix r16-6710-gda5a5c55284969:
* test name now reflect the size of the generator range,
* extracted code repeated between tests was exctracted to run_generator,
* expanded non-power of two ranges types to cover all IEC559 floating point,
* select values to test based on the size of mantisa instead of type,
  handling different long double representations.

The test now cover the cases, where mutliple value greater than one are
produced (and skipped) in the row. To avoid test running infinite loop,
the number of skips per element is limited by max_skips_per_elem template
parameter of run_generator.

The values checked in test_2p31m1<double> differs from their old test03<double>
counterpart, as we now request mantissa - 5 bits for each type (48bits for
ieee64) instead of previously hardoced 30bits.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc:
	Updated tests.

Reviewed-by: Nathan Myers <ncm@cantrip.org>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2026-04-30 07:44:12 +02:00
GCC Administrator
4695252ee8 Daily bump. 2026-04-30 00:16:31 +00:00
Tomasz Kamiński
efe29124c7 libstdc++: Test ATOMIC_*_LOCK_FREE macros for <stdatomic.h>
Coverage for LWG 4480, "<stdatomic.h> should provide ATOMIC_CHAR8_T_LOCK_FREE".

libstdc++-v3/ChangeLog:

	* testsuite/29_atomics/headers/stdatomic.h/macros.cc:
	Copy of ../atomic/macros.cc with header include changed.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-29 11:33:12 +02:00
Alexandre Oliva
8b52a53987 libstdc++: simd: x86: accept 64-bit long double as double [PR124657]
Various simd_x86 functions that handle double need to be adjusted to
match 64-bit long double as well.

Introduce __is_x86_ps<_Tp>() and __is_x86_pd<_Tp>() and use them
instead of is_same_v<_Tp, float> and is_same_v<_Tp, double>,
respectively.


for  libstdc++-v3/ChangeLog

	PR libstdc++/124657
	* include/experimental/bits/simd_x86.h
	(__is_x86_ps<_Tp>): New.  Replace is_same_v<_Tp, float> with it.
	(__is_x86_pd<_Tp>): New.  Replace is_same_v<_Tp, double> with it.
2026-04-28 22:31:32 -03:00
Alexandre Oliva
a575c51916 libstdc++: simd: map 64-bit long double to double on sse [PR124657]
When long double is as wide as double on x86 (-mlong-double-64), make
the __intrinsic_type a vector of double.


for  libstdc++-v3/ChangeLog

	PR libstdc++/124657
	* include/experimental/bits/simd.h (__intrinsic_type::type):
	Map long double to double.
2026-04-28 22:31:27 -03:00
Alexandre Oliva
eb829c6789 libstdc++: follow std in numeric_limits<bool>::traps and integral traps
There's a comment from 2002 suggesting that
numeric_limits<bool>::traps was in a DR, but C++ standards including
11, 17 and 23 explicitly set it to false, presumably in response to
issue 184.

Issue 554 clarifies that traps is about values that may trap, rather
than operations that may trap, so we were wrong in the interpretation
about divide-by-zero operations' trapping on integral types that led
to __glibcxx_integral_traps's defaulting to true, and some of its
overrides.

Align numeric_limits<bool>::traps with the standard, default
__glibcxx_integral_traps to false, drop the overriders based on the
incorrect interpretation, but keep __glibcxx_integral_traps to allow
command-line restoring of this ABI fix, and for the admittedly
unlikely case of trapping integral values' coming to exist on some
architecture.


for  libstdc++-v3/ChangeLog

	* include/std/limits (__glibcxx_integral_traps): Set to
	false.  Update comments.
	(numeric_limits<bool>::traps): Drop comments.
	* config/cpu/arm/cpu_defines.h: Remove.
	* config/cpu/powerpc/cpu_defines.h: Likewise.
	* configure.host (cpu_defines_dir): Adjust.
2026-04-28 22:31:23 -03:00
GCC Administrator
fccea8edc3 Daily bump. 2026-04-29 00:16:40 +00:00
Jonathan Wakely
3c901b72dc libstdc++: Update C++23 status table
This hasn't been updated to reflect the new features in GCC 16 (and one
that was backported to gcc-15 for GCC 15.3 but not released yet).

libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2023.xml: Update status table.
	* doc/html/manual/status.html: Regenerate.
2026-04-28 18:31:12 +01:00
Jonathan Wakely
eda0f2f0cc libstdc++: Update documentation about default -std option
libstdc++-v3/ChangeLog:

	* doc/xml/manual/using.xml (Flags): Update description of
	default value for -std option.
	* doc/html/manual/using.html: Regenerate.
2026-04-28 18:31:12 +01:00
Tomasz Kamiński
94b37910f6 libstdc++: Make pointer_traits::pointer_to constexpr for main template.
This resolves LWG3454, "pointer_traits::pointer_to should be constexpr",
accepted in Kona 2025.

The change is applied since C++20, i.e. standard in which pointer_to
was made constexpr for T* specialization.

libstdc++-v3/ChangeLog:

	* include/bits/ptr_traits.h (__ptr_traits_ptr_to::pointer_to):
	Define as constexpr since C++20.
	* testsuite/20_util/pointer_traits/pointer_to_constexpr.cc:
	New test for custom pointer-like type.
2026-04-28 16:08:36 +02:00
Tomasz Kamiński
47480a30d0 libstdc++: Expand tests for std::type_order.
Expanded test coverage to include:
* array of unknown bounds
* function types and pointers
* data and function member pointers

libstdc++-v3/ChangeLog:

	* testsuite/18_support/comparisons/type_order/1.cc: Add tests
	for more type.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp26/type-order1.C: Add tests for more type.

Reviewed-by: Jakub Jelinek <jakub@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-28 14:37:44 +02:00
GCC Administrator
e487b4ae30 Daily bump. 2026-04-28 00:16:32 +00:00
Jakub Jelinek
7f4cc8140e libstdc++: Fix up std::is_scalar for std::meta::info [PR125024]
https://eel.is/c++draft/basic.types.general#9.sentence-1 says that
std::meta::info and its cv-qualified versions are scalar types too
(and in https://eel.is/c++draft/basic.fundamental#19.sentence-1
that they are fundamental types too).
Now, on the reflection side, eval_is_scalar_type is handled
in the compiler and uses SCALAR_TYPE_P (type) which includes
REFLECTION_TYPE_P check and eval_is_fundamental_type includes that
explicitly too.
std::is_fundamental uses
   template<typename _Tp>
     struct is_fundamental
     : public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
                    is_null_pointer<_Tp>
 #if __cpp_impl_reflection >= 202506L
                    , is_reflection<_Tp>
 #endif
                    >::type
     { };
but for std::is_scalar we apparently forgot to include is_reflection.

The following patch fixes that.

2026-04-26  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/125024
	* include/std/type_traits (std::is_scalar): For
	__cpp_impl_reflection >= 202506L handle is_reflection types as
	scalar.
	* testsuite/20_util/is_scalar/reflection.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2026-04-27 13:30:58 +02:00
GCC Administrator
e1a64071e8 Daily bump. 2026-04-25 00:16:33 +00:00
Tomasz Kamiński
8efbea7eee libstdc++: Disallow duration of cv-qualified types and references.
This implements LWG 4481, "Disallow chrono::duration<const T, P>",
which was approved in Croydon 2026.

libstdc++-v3/ChangeLog:

	* include/bits/chrono.h: Add static_assert requiring cv-unqualified
	non-reference type.
	* testsuite/20_util/duration/io.cc: Remove const-qualifier in
	stream manipluators tests.
	* testsuite/20_util/duration/requirements/typedefs_neg4.cc:
	New test.
2026-04-24 17:43:26 +02:00
Tomasz Kamiński
490eca9b76 libsdc++: Restore check for validity of std::get for elements_view.
Resolves LWG3797, "elements_view insufficiently constrained".

When P2165R4 updated __has_tuple_element in C++23 to reuse __tuple_like
concept, it dropped the requirement of validity of get, assuming that for
tuple_like type with size of N, get<I> on lvalue is well-formed for any I < N.
This however does not hold for ranges::subrange (tuple-like of size 2) with
move-only iterator, for which get can only be applied on rvalue. In consequence
constrains allowed instantiating elements_view for range of such subrange,
but instantiating it's iterator lead to hard error from iterator_category
computation.

This patch applies the requirements on validity of get also in C++23 and
later standard modes.

libstdc++-v3/ChangeLog:

	* include/std/ranges (__detail::__has_tuple_element): Check
	if std::get<_Nm>(__t) returns referenceable type also for C++23
	and later.
	* testsuite/std/ranges/adaptors/elements.cc: Add test covering
	vector of ranges::subrange with move-only iterator.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-24 16:59:38 +02:00
Tomasz Kamiński
9a00a26364 libstdc++: Reject using views::iota on iota_view.
Resolves LWG4096, views::iota(views::iota(0)) should be rejected.

For __e of type _Tp that is specialization of iota_view, the CTAD based
expression iota_view(__e) is well formed, and creates a copy of __e.
As iota_view<decay_t<_Tp>> is ill-formed in this case (iota_view is not
weakly_incrementable), using that type in return type explicitly, removes
the overload from overload resolution in this case.

The (now redudant) __detail::__can_iota_view constrain in template head is
preserved, to provide error messages consistent with adaptors for other
non-incrementable types.

libstdc++-v3/ChangeLog:

	* include/std/ranges (_Iota::operator()(_Tp&&)): Replace
	auto return type and CTAD with iota_view<decay_t<_Tp>>.
	* testsuite/std/ranges/iota/iota_view.cc: Tests if
	views::iota(iota_view) is rejected.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-24 14:10:16 +02:00
Tomasz Kamiński
8defa4b8b1 libstdc++: Constrain views::adjacent(_transform)?<0> to forward_ranges.
This resolves LWG 4098, "views::adjacent<0> should reject non-forward ranges"
which was approved in Sofia 2024.

libstdc++-v3/ChangeLog:

	* include/std/ranges (_AdjacentTransform::operator())
	(_Adjacent::operator()): Require forward_range for N == 0.
	* testsuite/std/ranges/adaptors/adjacent/1.cc: Test if input_ranges
	are rejected.
	* testsuite/std/ranges/adaptors/adjacent_transform/1.cc: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-24 12:29:56 +02:00
Tomasz Kamiński
f3d9afa91c libstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS comment for LWG4083.
The LWG4083, "views::as_rvalue should reject non-input ranges" is resolved,
as input_range<_Range> is implied by __detail::__can_as_rvalue_view<_Range>.

libstdc++-v3/ChangeLog:

	* include/std/ranges: Add comment for LWG4083.
2026-04-24 11:32:13 +02:00
Tomasz Kamiński
799e24aded libstdc+: Provide iterator type for basic_const_iterator.
This resolves LWG 4253, "basic_const_iterator should provide iterator_type"
which was approved in Kona 2025.

libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h (basic_const_iterator::iterator_type):
	Define.
	* testsuite/24_iterators/const_iterator/1.cc: Tests for
	iterator_type.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-24 11:29:08 +02:00
Jonathan Wakely
b8fd759dc6 libstdc++: Update tzdata to 2026a
Import the new 2026a tzdata.zi file and new leapseconds expiry date.

libstdc++-v3/ChangeLog:

	* include/std/chrono (chrono::__detail::__get_leap_second_info):
	Update expiry date for leap seconds list.
	* src/c++20/tzdb.cc (tzdb_list::_Node::_S_read_leap_seconds):
	Likewise.
	* src/c++20/tzdata.zi: Import new file from 2026a release.
2026-04-24 10:02:43 +01:00
GCC Administrator
f28e24d91b Daily bump. 2026-04-24 00:16:27 +00:00
Tomasz Kamiński
2985bacae4 libstdc++: Include bool conversion in noexcept specification of indirect::operator==.
This expands the resolution of LWG4325 to heterogenous comparision
with T per standard draft (see corresponding commit [1]).

[1] 833d635d64

libstdc++-v3/ChangeLog:

	* include/bits/indirect.h (indirect::operator==): Adjust
	noexcept specification.
	* testsuite/std/memory/indirect/relops.cc: New test for noexcept
	specification.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-23 13:05:35 +02:00
Tomasz Kamiński
2653c16582 libstdc++: Implement __integral_constant_like in terms of __constexpr_wrapper_like.
This implements LWG4486. integral-constant-like and constexpr-wrapper-like
exposition-only concept duplication.

libstdc++-v3/ChangeLog:

	* include/bits/simd_details.h (simd::__constexpr_wrapper_like):
	Move to...
	* include/std/concepts (std::__constexpr_wrapper_like): Moved
	from bits/simd_details.h.
	* include/std/span (std::__integral_constant_like): Define in
	terms of __constexpr_wrapper_like.
	* testsuite/std/simd/traits_impl.cc: Added using declaration
	for std::__constexpr_wrapper_like.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-23 12:27:58 +02:00
GCC Administrator
c7afa79c36 Daily bump. 2026-04-23 00:16:32 +00:00
Jakub Jelinek
376d03b7b4 c++, libstc++: Bump __cpp_impl_reflection and __cpp_lib_reflection
Both __cpp_impl_reflection and __cpp_lib_reflection were increased from
202506L to 202603L post Croydon, I assume to show that P3795R2 (maybe some
issues too) have been implemented.
Now, we do implement P3795R2 except for the is_applicable_type,
is_nothrow_applicable_type and apply_result metafunctions, but Jonathan says
there is agreement in LWG that to test for availability of those one should
test __cpp_lib_reflection >= 202603L && __cpp_lib_apply >= 202603L.

So, this patch bumps both FTMs.

2026-04-22  Jakub Jelinek  <jakub@redhat.com>

gcc/c-family/
	* c-cppbuiltin.cc (c_cpp_builtins): Bump __cpp_impl_reflection value
	from 202506L to 202603L.
gcc/testsuite/
	* g++.dg/DRs/dr2581-2.C: Adjust for __cpp_impl_reflection bump from
	202506L to 202603L.
	* g++.dg/reflect/feat1.C: Likewise.  Also adjust for
	__cpp_lib_reflection bump from 202506L to 202603L.
	* g++.dg/reflect/feat2.C: Likewise.
	* g++.dg/reflect/feat3.C: Likewise.
libstdc++-v3/
	* include/bits/version.def (reflection): Bump 202506L to 202603L
	for both v and in extra_cond.
	* include/bits/version.h: Regenerate.
	* include/std/meta: Compare __glibcxx_reflection against
	202603L rather than 202506L.
	* src/c++23/std.cc.in: Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2026-04-22 15:03:48 +02:00
Tomasz Kamiński
93a125db9c libstdc++: Mandate power of two alignment for std::is_sufficiently_aligned.
This implements LWG4290. Missing Mandates clauses on is_sufficiently_aligned.

libstdc++-v3/ChangeLog:

	* include/bits/align.h (is_sufficiently_aligned): Mandate
	that _Align is power of two.
	* testsuite/20_util/is_sufficiently_aligned/2_neg.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-22 14:39:37 +02:00
Tomasz Kamiński
20d0b35cc7 libstdc++: Accept data_handle_type by value in mdspan deduction guide.
This makes the deduction guide accepting data_handle_type, mapping
and accessor consistent with corresponding constructor.
Resolves LWG4511.

libstdc++-v3/ChangeLog:

	* include/std/mdspan (mdspan): Remove reference from
	_AccessorType::data_handle_type parameteter of deduction
	guide.
	* testsuite/23_containers/mdspan/mdspan.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-22 11:51:05 +02:00
Tomasz Kamiński
02021cd894 libstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS for already implemented issues.
This covers issue affecting pre-C+26 features that were resolved
during 2026 Croydon meeting.

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h: Add comment for LWG3831.
	* include/bits/print.h: Add comment for LWG4549.
	* include/std/condition_variable: Add comment for LWG3504.
	* include/std/format: Add comments for LWG4522.
	* include/std/mdspan: Add comment for LWG4314.
	* include/std/optional: Add comment for LWG2746.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-22 11:50:07 +02:00