16816 Commits

Author SHA1 Message Date
Jonathan Wakely
d0e0f6beb1 libstdc++: Remove vertical whitespace from code listings in manual
This removes unnecessary whitespace following <pre> blocks in the HTML
output.

libstdc++-v3/ChangeLog:

	* doc/xml/faq.xml: Remove unwanted whitespace inside
	programlisting elements.
	* doc/xml/manual/allocator.xml: Likewise.
	* doc/xml/manual/auto_ptr.xml: Likewise.
	* doc/xml/manual/backwards_compatibility.xml: Likewise.
	* doc/xml/manual/build_hacking.xml: Likewise.
	* doc/xml/manual/containers.xml: Likewise.
	* doc/xml/manual/diagnostics.xml: Likewise.
	* doc/xml/manual/extensions.xml: Likewise.
	* doc/xml/manual/intro.xml: Likewise.
	* doc/xml/manual/io.xml: Likewise.
	* doc/xml/manual/iterators.xml: Likewise.
	* doc/xml/manual/numerics.xml: Likewise.
	* doc/xml/manual/policy_data_structures.xml: Likewise.
	* doc/xml/manual/strings.xml: Likewise.
	* doc/xml/manual/support.xml: Likewise.
	* doc/xml/manual/test.xml: Likewise.
	* doc/xml/manual/using.xml: Likewise.
	* doc/xml/manual/utilities.xml: Likewise.
	* doc/html/*: Regenerate.
2025-11-19 21:54:12 +00:00
Andrew Pinski
47ebad54ab libstdc++: store the length after the store of the null character
This improves the code generation slightly for std::string because of
aliasing. In many cases the length will be read again and the store of
the null character will cause the length to be re-read due to aliasing
requirements of the char type. So swapping around the stores will allow
the length not to have to be reloaded from memory and will allow
for more optimizations.

Bootstrapped and tested on x86_64-linux-gnu.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (basic_string::M_set_length): Swap
	around the order of traits_type::assign and _M_length so that
	_M_length is at the end.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-11-19 09:14:05 -08:00
Martin Liska
17f8a7821c regenerate configure files
libstdc++-v3/ChangeLog:

	* configure: Regenerate.

Signed-off-by: Martin Liška <martin.liska@hey.com>
2025-11-19 16:45:42 +01:00
Martin Liska
27450916cd support Wild linker
gcc/ChangeLog:

	* collect2.cc (main): Add wild linker to -fuse-ld.
	* common.opt: Likewise.
	* configure: Regenerate.
	* configure.ac: Add detection for wild linker.
	* doc/invoke.texi: Document -fuse-ld=wild.
	* gcc.cc (driver_handle_option): Support -fuse-ld=wild.
	* opts.cc (common_handle_option): Likewise.

libatomic/ChangeLog:

	* acinclude.m4: Add detection for wild linker.
	* configure: Regenerate.

libgomp/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

libitm/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

Signed-off-by: Martin Liška <martin.liska@hey.com>
2025-11-19 16:07:57 +01:00
Luc Grosheintz
58b88748e6 libstdc++: Make <mdspan> compatible with clang.
These three changes are needed to make <mdspan> compatible with Clang:

  - the type alias _Storage must occur before its first use.

  - the friend declarations of function must match exactly, including
  noexcept and constexpr.

  - the 'template' in typename T::template type<double>.

libstdc++-v3/ChangeLog:

	* include/std/mdspan (extents::_Storage): Move type alias before
	its first use.
	(__mdspan::__static_extents): Add missing noexcept and constexpr
	to friend declaration in extents.
	(__mdspan::__dynamic_extents): Ditto.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-11-19 15:47:11 +01:00
Jakub Jelinek
3d000da532 c++, libstdc++: Implement CWG1670 and LWG4468
The following patch attempts to implement CWG1670 and related LWG4468.

2025-11-19  Jakub Jelinek  <jakub@redhat.com>

gcc/cp/
	* parser.cc (cp_parser_conversion_type_id): Implement C++ DR1670
	- auto as conversion-type-id.  Pedwarn on conversion operators
	with placeholder return type.
gcc/testsuite/
	* g++.dg/DRs/dr1670-1.C: New test.
	* g++.dg/DRs/dr1670-2.C: New test.
	* g++.dg/DRs/dr1670-3.C: New test.
	* g++.dg/modules/auto-1_a.H: Use dg-options instead of
	dg-additional-options.
	* g++.dg/modules/auto-1_b.C: Likewise.
	* g++.dg/cpp1y/auto-fn12.C: Likewise.
	* g++.dg/cpp1y/auto-fn13.C: Add empty dg-options.
	* g++.dg/cpp1y/auto-fn22.C: Likewise.
	* g++.dg/cpp1y/constexpr-assert2.C: Likewise.
	* g++.dg/cpp1y/auto-fn44.C: Add dg-options -Wpedantic and expect
	further warnings.
	* g++.dg/cpp1y/auto-fn50.C: Likewise.
	* g++.dg/cpp0x/auto9.C: Expect two errors always rather than just
	for C++11.
libstdc++-v3/
	* include/std/type_traits (constant_wrapper conversion operator):
	Use decltype(value) instead of decltype(auto).  Resolves LWG4468.
2025-11-19 11:03:07 +01:00
Jakub Jelinek
5294e0a0b4 libstdc++: Implement proposed resolution of LWG4477 [PR122671]
This patch implements the proposed resolution of
https://cplusplus.github.io/LWG/issue4477
The PR complains that one can't successfully throw from constructor
in placement new in a constant expression and catch that exception
later on.  The problem is while P2747R2 made placement ::operator new
and ::operator new[] constexpr, when the ctor throws it invokes also
these weird placement ::operator delete and ::operator delete[]
which intentionally perform no action, and those weren't constexpr,
so constant expression evaluation failed.

2025-11-19  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/122671
	* libsupc++/new (::operator delete, ::operator delete[]): Implement
	proposed LWG4477 resolution.  Use _GLIBCXX_PLACEMENT_CONSTEXPR for
	placement operator deletes.

	* g++.dg/cpp26/constexpr-eh17.C: New test.
2025-11-19 09:38:17 +01:00
GCC Administrator
608420810f Daily bump. 2025-11-19 00:19:58 +00:00
Mike Crowe
a39fec8c74 libstdc++: shared_mutex: Respond consistently to errors and deadlock
Make the shared_mutex::try_lock(), shared_timed_mutex::try_lock_until()
and shared_timed_mutex::try_lock_shared_until() all handle errors from
pthread functions consistently by returning false to indicate that the
lock could not be taken. If _GLIBCXX_ASSERTIONS is defined then
unexpected errors, such as EDEADLK and EINVAL will cause an assertion
failure. If _GLIBCXX_ASSERTIONS is not defined then these functions no
longer ever return true incorrectly indicating that they have taken the
lock.

This removes the previous behaviour of looping on EDEADLK in
try_lock_shared_until() and no longer returns true on EINVAL in all of
these functions. (In theory at least it should not be possible to
trigger EINVAL since 5dba17a3e709859968f939354e6e5e8d796012d3.)

Unfortunately my reading of POSIX is that pthread_rwlock_clockrdlock[1],
pthread_rwlock_timedrdlock pthread_rwlock_clockwrlock[2] and
pthread_rwlock_timedwrlock are allowed to deadlock rather than return
EDEADLK when trying to take a lock a second time from the same
thread. This means that the deadlock tests cannot be enabled by
default. I believe that the tests do work with glibc (2.31 & 2.36) and
with the __shared_mutex_cv implementation though.

[1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_rwlock_clockrdlock.html
[2] https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_rwlock_clockwrlock.html

libstdc++-v3/ChangeLog:

	* include/std/shared_mutex (try_lock, try_lock_until)
	(try_lock_shared_until): Respond consistently to errors and
	deadlocks.
	* testsuite/30_threads/shared_timed_mutex/try_lock_until/116586.cc:
	Test deadlock behaviour if possible.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
2025-11-18 17:13:44 +00:00
Tomasz Kamiński
ac45382d0c libstdc++: Fix construction function_ref from nontype<&S::x> and reference_wrapper [PR121858]
To reduce instantiation count, function_ref(nontype<&S::x>, r) previously
reused the invoker from function_ref(nontype<&S::x>, &r). This assumed r was
always a reference to S or a derived class. However, this constructor is also
valid for lvalues (but not rvalues) of reference_wrapper specializations.

This patch fixes this by limiting above optimization only to situations,
when argument is not specialization of reference_wrapper. This is achieved
bu comparing __inv_unwrap<_Td>::type with _Td. We use __inv_unwrap because
unwrap_reference_t does not handle cv-qualified types.

	PR libstdc++/121858

libstdc++-v3/ChangeLog:

	* include/bits/funcref_impl.h
	(function_ref::function_ref(nontype<__fn>, _Up&&)): Handle.
	reference_wrapper.
	* testsuite/20_util/function_ref/call.cc: Call and update
	test05(). Add new test06() for reference_wrapper.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-11-18 11:51:16 +01:00
GCC Administrator
0aac01bfa6 Daily bump. 2025-11-18 00:21:51 +00:00
Jonathan Wakely
77278e0292 libstdc++: Fix error reporting for filesystem::rename on Windows [PR122726]
Use the __last_system_error() function and the system_category to
convert the Windows error to a generic one.

libstdc++-v3/ChangeLog:

	PR libstdc++/122726
	* src/filesystem/ops-common.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
	(rename): Use __last_system_error to set errno accurately.
	* testsuite/27_io/filesystem/operations/rename.cc: Test
	error_code matches errc::no_such_file_or_directory.
2025-11-17 21:18:24 +00:00
Jonathan Wakely
edde0ae2b5 libstdc++: Fix std module for gcc4-compatible ABI
Add preprocessor checks to std.cc.in for features which are not
supported with the old string ABI.

The COW std::string doesn't properly support C++11 allocators, so the
aliases such as std::pmr::string, std::pmr::u8string etc. are not
defined for the old string ABI.

The std::syncbuf type uses std::string and is not defined for the old
string ABI.

libstdc++-v3/ChangeLog:

	* src/c++23/std.cc.in [!__cpp_lib_syncbuf]: Disable exports for
	<syncstream> contents when not defined.
	[!_GLIBCXX_USE_CXX11_ABI]: Disable exports for pmr aliases in
	<string> when not defined.
2025-11-17 17:57:17 +00:00
Jason Merrill
359d48af20 libstdc++: testsuite/util adjustments for import std
In my import std testing patch, to work around c++/99000 (include after
import) I move #includes of the util/ headers above the import.  And so I
made some adjustments to those headers to support this: adding some missing
dependencies, making sure that in headers that include both importable and
non-importable headers, at least one importable header comes first to work
with my patch to translate e.g. #include <vector> to import <bits/stdc++.h>.

The testsuite_iterators.h avoids a failure in
20_util/specialized_algorithms/uninitialized_copy/constrained.cc from
including <memory> after this header, with a mysterious "no match for
operator<" between long and difference_type.

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_allocator.h: Move importable headers up.
	* testsuite/util/testsuite_common_types.h: Likewise.
	* testsuite/util/testsuite_containers.h: Likewise.
	* testsuite/util/testsuite_error.h: Move includes inside
	include guard.
	* testsuite/util/testsuite_greedy_ops.h: #include <cstddef>.
	* testsuite/util/testsuite_iterators.h: #include <utility>.
	* testsuite/util/testsuite_new_operators.h: #include <cstdlib>.
	* testsuite/util/testsuite_random.h: #include <random>.
2025-11-17 21:26:40 +05:30
GCC Administrator
1b71fbc17f Daily bump. 2025-11-17 00:19:25 +00:00
Jonathan Wakely
84dbb22f32 libstdc++: Include <mutex> in syncbuf.cc [PR122698]
For most configurations bits/std_mutex.h would already be included by
<syncstream>, but not if configured with _GLIBCXX_USE_CXX11_ABI=0 as the
default, because syncbuf is disabled in that case.

libstdc++-v3/ChangeLog:

	PR libstdc++/122698
	* src/c++20/syncbuf.cc (__syncbuf_get_mutex): Include <mutex>.
	Fix indentation of function body.
2025-11-16 14:00:55 +00:00
Rainer Orth
d9a19e6805 Remove /usr/ccs references on Solaris
/usr/ccs/bin has been replaced by a symlink to /usr/bin since at least
Solaris 11.3, so there's no reason to use that path any longer.

This patch removes all references to it.

Tested on i386-pc-solaris2.11.

2025-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (md_exec_prefix): Don't set on Solaris.
	* configure: Regenerate.

	contrib:
	* make_sunver.pl ($elfdump): Remove ccs from path.

	gcc:
	* config/sol2.h (MD_EXEC_PREFIX): Remove.

	libstdc++-v3:
	* scripts/extract_symvers.pl: Remove ccs from elfdump path.
2025-11-16 14:00:11 +01:00
GCC Administrator
9d0f374375 Daily bump. 2025-11-16 00:19:20 +00:00
Jonathan Wakely
85066ad6c3 libstdc++: Tweak static_assert messages for volatile atomic waits
libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h: Tweak grammar of static assert
	messages for unsupported atomic wait on volatile.
2025-11-15 21:45:44 +00:00
Jonathan Wakely
bbbd6a97f3 libstdc++: Minor refactoring in __wait_until_impl in atomic.cc
libstdc++-v3/ChangeLog:

	* src/c++20/atomic.cc (__wait_impl): Fix outdated comment.
	(__wait_until_impl): Simplify return statements.
2025-11-15 21:45:44 +00:00
GCC Administrator
8d2e8dbf77 Daily bump. 2025-11-15 00:21:45 +00:00
Tom Tromey
de124ffe14 Add 'num_children' method to relevant pretty-printers
A user pointed out that, in DAP mode, gdb would hang while trying to
display a certain vector.  See

    https://sourceware.org/bugzilla/show_bug.cgi?id=33594

This is caused by a combination of things: the vector is
uninitialized, DAP requires a count of the number of children of a
variable, and libstdc++ printers don't implement the 'num_children'
method, so gdb tries to count children by iterating.

In this case, the vector has a nonsensical size:

    (gdb) p myVector
    $1 = std::vector of length -34979931, capacity -33992726

This patch adds a 'num_children' method to a subset of the
pretty-printers, in particular ones where I thought the length might
be arbitrarily large and susceptible to being garbage when the object
isn't initialized.

I've also specifically added a check to the vector printer for the
case where the length is negative.

These container printers could be further improved by adding the
'child' method, allowing random access to child objects.  However I
haven't done that here.

libstdc++-v3/ChangeLog

	* python/libstdcxx/v6/printers.py (StdVectorPrinter._bounds):
	New method.
	(StdVectorPrinter.to_string): Use it.
	(StdVectorPrinter.num_children): New method.
	(StdStackOrQueuePrinter.num_children): New method.
	(StdMapPrinter.num_children): New method.
	(StdSetPrinter.num_children): New method.
	(StdDequePrinter._size): New method.
	(StdDequePrinter.to_string): Use it.
	(StdDequePrinter.num_children): New method.
	(Tr1UnorderedSetPrinter.num_children): New method.
	(Tr1UnorderedMapPrinter.num_children): New method.
	(StdSpanPrinter.num_children): New method.
2025-11-14 12:10:16 -07:00
Tomasz Kamiński
f94a73e0fc libstdc++: Ensure that _Utf_view is always a view.
Previously, _Utf_view accepted any input_range, including reference-to-array
types like char(&)[2], and stored it as the _M_base member. In such cases,
_Utf_view was not assignable, failing the requirements of view concept.

This patch addresses the issue by adding the ranges::view constraint to the
second template parameter of _Utf_view, and for clarity renaming it from
_Range to _View. The constructor is also adjusted to accept its argument
by value (views must be O(1) move-constructible). This prevents implicitly
generated CTAD from deducing a reference type.

This makes _Utf_view consistent with both other standard views and the
wording from P2728R8: Unicode in the Library, Part 1: UTF Transcoding [1].

The explicit CTAD from viewable_range is not defined for _Utf_view because
it depends on views::all_t, views::ref_view, and views::owning_view,
which are declared in <ranges>. Consequently, users must explicitly cast
the argument to a view or specify it as a template parameter.

[1] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2728r8.html

libstdc++-v3/ChangeLog:

	* include/bits/unicode.h (_Utf_view): Rename the template parameter
	from _Range to _View and constrain it with ranges::view.
	(_Utf_view::_Utf_view): Accept by value instead of rvalue reference.
	* include/std/format (__format::__write_padded): Replace _Utf_view
	over const char32_t(&)[1] with span<const char32_t, 1>.
	* testsuite/ext/unicode/view.cc: Add checks if specialization
	of _Utf_view satisfy view. Wrap arrays into std::span before
	constructing _Utf_view.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-11-14 18:27:01 +01:00
Jonathan Wakely
7a5a92a643 libstdc++: Add comment to __cpp_lib_bitset preprocessor condition
libstdc++-v3/ChangeLog:

	* include/std/bitset: Add comment to feature test macro test.
2025-11-14 13:08:53 +00:00
Karpalo Toivonen
e7ba197b19 libstdc++: std::bitset<0>("zero") should throw std::invalid_argument [PR121054]
According to the standard the first n characters of a bitset constructor
string need to be checked instead of only N.

libstdc++-v3/ChangeLog:

	PR libstdc++/121054
	* include/std/bitset: Add string check to constructor.
	* testsuite/20_util/bitset/121054.cc: New test.
	* testsuite/20_util/bitset/cons/constexpr_c++23.cc: Fix.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
2025-11-14 13:08:52 +00:00
Tomasz Kamiński
71004c2414 libstdc++: Use _Bind_front_t/_Bind_back_t in bind_front<f>/bind_back<f> [PR122032]
This patch changes the implementation of bind_front<f> and bind_back<f> to
return a _Bind_front_t<_Bind_fn_t<f>, ...> and _Bind_back_t<_Bind_fn_t<f>, ...>
respectively, replacing the previous lambda-based implementation. The prior use
of a lambda caused non-conforming behavior with respect to C++23 [func.require]
p8, which requires that bind_front<f>(s), bind_front<f>(move(s)), and
bind_front<f>(as_const(s)) produce the same type.

Additionally, using specialized structs reduces the size of the resulting functor
in certain scenarios (see PR).

For the zero-argument case, the function still returns a _Bind_fn_t<f>. Since this
type is already a perfect forwarding call wrapper, it yields the same result as
_Bind_front_t<_Bind_fn_t<f>>.

A consequence of this change is that the types returned by bind_front<f>(args...)
and bind_back<f>(args...) are no longer structural - they are not required to be
structural by the standard.

	PR libstdc++/122032

libstdc++-v3/ChangeLog:

	* include/std/functional (std::bind_front<f>, std::bind_back<f>):
	Define in terms of _Bind_front_t/_Bind_back_t.
	* testsuite/20_util/function_objects/bind_back/nttp.cc: New tests.
	* testsuite/20_util/function_objects/bind_front/nttp.cc: New tests.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-11-14 12:38:27 +01:00
GCC Administrator
890dff609d Daily bump. 2025-11-14 00:20:34 +00:00
Jonathan Wakely
9332dfd452 libstdc++: Fix std::forward_list::assign assignable check [PR122661]
The std::is_assignable check should test for assignment to an lvalue,
not an rvalue.

libstdc++-v3/ChangeLog:

	PR libstdc++/122661
	* include/bits/forward_list.h (forward_list::assign(I, I)): Fix
	value category in is_assignable check.
	* testsuite/23_containers/forward_list/modifiers/122661.cc:
	New test.
2025-11-13 14:29:15 +00:00
Xavier Bonaventura
bc7a89048e libstdc++: testsuite: Add csignal missing test for SIG_IGN
SIG_IGN also needs to be defined according to the C++ standard.
This was missing in the test.

	* testsuite/18_support/headers/csignal/macros.cc: Check for
	SIG_IGN.

Signed-off-by: Xavier Bonaventura <xavibonaventura@gmail.com>
2025-11-13 14:29:08 +00:00
Xavier Bonaventura
228433365c libstdc++: testsuite: Add climits missing LL tests
"long long" and "unsigned long long" min and max macros were added in
C++11, but they were not present in the climits test.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/headers/climits/values.cc: Check for
	LLONG_MIN, LLONG_MAX, and ULLONG_MAX.

Signed-off-by: Xavier Bonaventura <xavibonaventura@gmail.com>
2025-11-13 14:28:53 +00:00
Tomasz Kamiński
35f05d04f3 libstdc++: Optimize handling of optional for views: take, drop, reverse and as_const.
This implements P3913R1: Optimize for std::optional in range adaptors.

Specifically, for an opt of type optional<T> that is a view:
* views::reverse(opt), views::take(opt, n), and views::drop(opt, n) returns
   optional<T>.
* views::as_const(opt), optional<T&> is converted into optional<const T&>.
  optional<T const> is not used in the non-reference case because, such
  type is not move assignable, and thus not a view.

libstdc++-v3/ChangeLog:

	* include/std/optional (__is_optional_ref): Define.
	* include/std/ranges (_Take::operator(), _Drop::operator())
	(_Reverse::operator()):	Handle optional<T> that are view.
	(_AsConst::operator()): Handle optional<T&>.
	* testsuite/20_util/optional/range.cc: New tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-11-13 14:35:11 +01:00
Tomasz Kamiński
427911622f libtdc++: Test atomic_ref<volatile T> only if operations are lock-free [PR122584]
For non-templated tests, a volatile_<T> alias is used. This alias expands to
volatile T if std::atomic_ref<T>::is_always_lock_free is true, and to T
otherwise. For templated functions, testing is controlled using if constexpr.

	PR libstdc++/115402
	PR libstdc++/122584

libstdc++-v3/ChangeLog:

	* testsuite/29_atomics/atomic_ref/address.cc: Guard test for
	volatile with if constexpr.
	* testsuite/29_atomics/atomic_ref/deduction.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/op_support.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/requirements.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/bool.cc: Use volatile_t alias.
	* testsuite/29_atomics/atomic_ref/generic.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/integral.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/pointer.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/float.cc: Likewise, and remove
	not discarding if constexpr.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-11-13 13:23:23 +01:00
GCC Administrator
a784ed8dad Daily bump. 2025-11-13 00:20:50 +00:00
Tomasz Kamiński
1fa5dd8f98 libstdc++: Add ranges::borrowed_range specialization for optional<T&> [PR122425]
PR libstdc++/122425

libstdc++-v3/ChangeLog:

	* include/std/optional
	(ranges::enable_borrowed_range<optional<_Tp&>>): Define.
	* testsuite/20_util/optional/range.cc: Update tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-11-12 09:25:54 +01:00
Tomasz Kamiński
d554b8a704 libstdc++: optional<T&> for function and unbounded array should not be range [PR122396]
This implements proposed resolution for LWG4308 [1].

For T denoting either function type or unbounded array, the optional<T&> no
longer exposes iterator, and viable begin/end members. The conditionally
provided iterator type, it is now defined in __optional_ref_base
base class.

Furthermore, range support for optional<T&> is now also guarded by
__cpp_lib_optional_range_support.

[1] https://cplusplus.github.io/LWG/issue4308

	PR libstdc++/122396

libstdc++-v3/ChangeLog:

	* include/std/optional (__optional_ref_base): Define.
	(std::optional<_Tp&>): Inherit from __optional_ref_base<_Tp>.
	(optional<_Tp&>::iterator): Move to base class.
	(optional<_Tp&>::begin, optional<_Tp&>::end): Use deduced return
	type and constrain accordingly.
	* testsuite/20_util/optional/range.cc: Add test for optional<T&>.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-11-12 09:24:09 +01:00
Jason Merrill
294cffd4d1 libstdc++: use -Wno-deprecated-declarations
-Wno-deprecated doesn't work with header units, since the testcase can't
change the header unit's version of the __DEPRECATED macro.  But
-Wno-deprecated-declarations works just fine to avoid warning about
deprecated things.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/exception_ptr/62258.cc: Use
	-Wno-deprecated-declarations instead of -Wno-deprecated.
	* testsuite/18_support/uncaught_exception/14026.cc
	* testsuite/20_util/headers/functional/synopsis.cc
	* testsuite/20_util/is_literal_type/requirements/explicit_instantiation.cc
	* testsuite/20_util/is_literal_type/requirements/typedefs.cc
	* testsuite/20_util/is_literal_type/value.cc
	* testsuite/20_util/is_pod/requirements/explicit_instantiation.cc
	* testsuite/20_util/is_pod/requirements/typedefs.cc
	* testsuite/20_util/is_pod/value.cc
	* testsuite/20_util/shared_ptr/assign/auto_ptr.cc
	* testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc
	* testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc
	* testsuite/20_util/shared_ptr/atomic/1.cc
	* testsuite/20_util/shared_ptr/atomic/2.cc
	* testsuite/20_util/shared_ptr/atomic/3.cc
	* testsuite/20_util/shared_ptr/cons/43820_neg.cc
	* testsuite/20_util/shared_ptr/cons/auto_ptr.cc
	* testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc
	* testsuite/20_util/shared_ptr/creation/dr925.cc
	* testsuite/20_util/unique_ptr/cons/auto_ptr.cc
	* testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc
	* testsuite/20_util/variable_templates_for_traits.cc
	* testsuite/29_atomics/atomic/lwg3220.cc
	* testsuite/experimental/type_traits/value.cc: Likewise.
2025-11-12 09:05:41 +05:30
Jason Merrill
bc68e43df5 libstdc++: sync prune.exp with GCC
I needed to add module context to dg-prune for libstdc++, and figured it
made sense to sync it with the GCC version rather than maintain slightly
different approaches to stripping the same messages.

libstdc++-v3/ChangeLog:

	* testsuite/lib/prune.exp: Sync with gcc prune.exp.
2025-11-12 09:05:41 +05:30
GCC Administrator
b99eddbe7c Daily bump. 2025-11-11 00:21:25 +00:00
Jakub Jelinek
52fc9f01da libstdc++: Implement final wording of C++26 P3778R0 - type_order
The approved P3778R0 wording doesn't have type_order<_Tp, _Up>::type, so
this patch removes it.

2025-11-10  Jakub Jelinek  <jakub@redhat.com>

	* libsupc++/compare: Implement final wording of C++26 P3778R0 - Fix
	for type_order template definition.
	(std::type_order): Remove type member.
2025-11-10 09:59:13 +01:00
GCC Administrator
0e9ccae269 Daily bump. 2025-11-04 00:20:26 +00:00
Sam James
f8bb20167f gcc: sync top-level with binutils-gdb
This just pulls in Alan's:

commit 87b6078fc212ccba5f043399c6370ee20f6b355a
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Mon Nov 3 10:59:50 2025 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Mon Nov 3 10:59:50 2025 +1030

    tidy m4 plugin config support

    ...

It tidies up the configure test output.

config/ChangeLog:

	* clang-plugin.m4: Sync with binutils.
	* gcc-plugin.m4: Ditto.

ChangeLog:

	* configure: Regenerate.

gcc/ChangeLog:

	* configure: Regenerate.

libatomic/ChangeLog:

	* configure: Regenerate.

libbacktrace/ChangeLog:

	* configure: Regenerate.

libcc1/ChangeLog:

	* configure: Regenerate.

libffi/ChangeLog:

	* configure: Regenerate.

libgcobol/ChangeLog:

	* configure: Regenerate.

libgfortran/ChangeLog:

	* configure: Regenerate.

libgm2/ChangeLog:

	* configure: Regenerate.

libgomp/ChangeLog:

	* configure: Regenerate.

libgrust/ChangeLog:

	* configure: Regenerate.

libiberty/ChangeLog:

	* configure: Regenerate.

libitm/ChangeLog:

	* configure: Regenerate.

libobjc/ChangeLog:

	* configure: Regenerate.

libphobos/ChangeLog:

	* configure: Regenerate.

libquadmath/ChangeLog:

	* configure: Regenerate.

libsanitizer/ChangeLog:

	* configure: Regenerate.

libssp/ChangeLog:

	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* configure: Regenerate.

libvtv/ChangeLog:

	* configure: Regenerate.

lto-plugin/ChangeLog:

	* configure: Regenerate.

zlib/ChangeLog:

	* configure: Regenerate.
2025-11-03 20:25:00 +00:00
Jason Merrill
5926cc99ae libstdc++: add ADL friends
Since the implementation namespaces __detail and __exception_ptr aren't
exported from std, ADL can't find these functions there.  Adding friend
declarations makes it work.

libstdc++-v3/ChangeLog:

	* include/bits/quoted_string.h: Add ADL friends.
	* libsupc++/exception_ptr.h: Add ADL friend.
2025-11-03 21:32:25 +03:00
Jason Merrill
237a83da19 libstdc++: adjust std module TBB workaround
Messing with macros before possibly importing the stdc++.h header unit is
bad form; better to mess with (other) macros afterward.

libstdc++-v3/ChangeLog:

	* src/c++23/std.cc.in: Move TBB macro shenanigans after
	bits/stdc++.h.
2025-11-03 18:55:06 +03:00
Jason Merrill
eaf6b40f76 libstdc++: remove cassert from stdc++.h
<cassert> isn't suitable for a header unit, because by design it depends on
the user NDEBUG macro.  So let's not include it in <bits/stdc++.h>.

libstdc++-v3/ChangeLog:

	* include/precompiled/stdc++.h: Remove <cassert>.
	* testsuite/util/exception/safety.h: Add <cassert>.
	* testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc:
	Don't define _GLIBCXX_NO_ASSERT.
2025-11-03 18:55:06 +03:00
Jason Merrill
725ce34b6c libstdc++: add attributes to more ios_base types
In r15-3499 I added attributes to _Ios_Openmode to avoid -Wswitch false
positives; let's do the same for the other enums in ios_base.

It also seems to me that with these attributes, the tests don't need to
include the end/max/min cases.

libstdc++-v3/ChangeLog:

	* include/bits/ios_base.h: Add attribs to _Ios_Fmtflags,
	_Ios_Iostate, _ios_seekdir.
	* testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Remove
	unneeded cases.
	* testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
	* testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.
	* testsuite/27_io/ios_base/types/seekdir/case_label.cc: Likewise.
2025-11-03 18:55:06 +03:00
GCC Administrator
39929ac25b Daily bump. 2025-11-03 00:18:56 +00:00
Jason Merrill
a06228ca4d libstdc++: add missing exports
These exports didn't get uncommented when the functionality was implemented.

libstdc++-v3/ChangeLog:

	* src/c++23/std.cc.in: Uncomment usings for vprint_*_buffered.
2025-11-02 22:20:49 +03:00
GCC Administrator
590c746c2e Daily bump. 2025-10-31 00:22:18 +00:00
Jakub Jelinek
acdf675933 libstd++: Implement C++23 P2674R1 - A trait for implicit lifetime types
The following patch attempts to implement the library side of the
C++23 P2674R1 paper.  As mentioned in the paper, since CWG2605
the trait isn't really implementable purely on the library side.

The compiler side has been committed earlier, so this just uses
the new builtin trait on the library side.

2025-10-30  Jakub Jelinek  <jakub@redhat.com>

	* include/bits/version.def (is_implicit_lifetime): New.
	* include/bits/version.h: Regenerate.
	* include/std/type_traits (std::is_implicit_lifetime,
	std::is_implicit_lifetime_v): New trait.
	* src/c++23/std.cc.in (std::is_implicit_lifetime,
	std::is_implicit_lifetime_v): Export.
	* testsuite/20_util/is_implicit_lifetime/version.cc: New test.
	* testsuite/20_util/is_implicit_lifetime/value.cc: New test.
2025-10-30 08:46:26 +01:00
GCC Administrator
1bb016ee11 Daily bump. 2025-10-30 00:19:28 +00:00