<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/libstdc++-v3/include/std/optional, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/'/>
<entry>
<title>libstdc++: Implement LWG 4406 and LWG 3424 for std::optional and std::expected</title>
<updated>2025-11-21T15:30:50+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-11-19T19:04:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=1725567dfce807e6395d726057ccc85b47a7f3c1'/>
<id>1725567dfce807e6395d726057ccc85b47a7f3c1</id>
<content type='text'>
This adjusts the return statements of optional::value_or and
expected::value_or to not perform explicit conversions, so that the
actual conversion performed matches the requirements expressed in the
Mandates: elements (LWG 4406).

Also adjust the return types to remove cv-qualifiers (LWG 3424).

libstdc++-v3/ChangeLog:

	* include/std/expected (expected::value_or): Use remove_cv_t for
	the return type. Do not use static_cast for return statement.
	Adjust static_assert conditions to match return statements.
	* include/std/optional (optional::value_or): Likewise.
	(optional&lt;T&amp;&gt;::value_or): Likewise.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adjusts the return statements of optional::value_or and
expected::value_or to not perform explicit conversions, so that the
actual conversion performed matches the requirements expressed in the
Mandates: elements (LWG 4406).

Also adjust the return types to remove cv-qualifiers (LWG 3424).

libstdc++-v3/ChangeLog:

	* include/std/expected (expected::value_or): Use remove_cv_t for
	the return type. Do not use static_cast for return statement.
	Adjust static_assert conditions to match return statements.
	* include/std/optional (optional::value_or): Likewise.
	(optional&lt;T&amp;&gt;::value_or): Likewise.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Optimize handling of optional for views: take, drop, reverse and as_const.</title>
<updated>2025-11-13T13:35:11+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-11-07T17:17:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=35f05d04f305dc51364469d20879dbea8810b0db'/>
<id>35f05d04f305dc51364469d20879dbea8810b0db</id>
<content type='text'>
This implements P3913R1: Optimize for std::optional in range adaptors.

Specifically, for an opt of type optional&lt;T&gt; that is a view:
* views::reverse(opt), views::take(opt, n), and views::drop(opt, n) returns
   optional&lt;T&gt;.
* views::as_const(opt), optional&lt;T&amp;&gt; is converted into optional&lt;const T&amp;&gt;.
  optional&lt;T const&gt; 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&lt;T&gt; that are view.
	(_AsConst::operator()): Handle optional&lt;T&amp;&gt;.
	* testsuite/20_util/optional/range.cc: New tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements P3913R1: Optimize for std::optional in range adaptors.

Specifically, for an opt of type optional&lt;T&gt; that is a view:
* views::reverse(opt), views::take(opt, n), and views::drop(opt, n) returns
   optional&lt;T&gt;.
* views::as_const(opt), optional&lt;T&amp;&gt; is converted into optional&lt;const T&amp;&gt;.
  optional&lt;T const&gt; 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&lt;T&gt; that are view.
	(_AsConst::operator()): Handle optional&lt;T&amp;&gt;.
	* testsuite/20_util/optional/range.cc: New tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Add ranges::borrowed_range specialization for optional&lt;T&amp;&gt; [PR122425]</title>
<updated>2025-11-12T08:25:54+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-11-06T15:02:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=1fa5dd8f9862c3314b4499c944906424d7a5a8e7'/>
<id>1fa5dd8f9862c3314b4499c944906424d7a5a8e7</id>
<content type='text'>
	PR libstdc++/122425

libstdc++-v3/ChangeLog:

	* include/std/optional
	(ranges::enable_borrowed_range&lt;optional&lt;_Tp&amp;&gt;&gt;): Define.
	* testsuite/20_util/optional/range.cc: Update tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	PR libstdc++/122425

libstdc++-v3/ChangeLog:

	* include/std/optional
	(ranges::enable_borrowed_range&lt;optional&lt;_Tp&amp;&gt;&gt;): Define.
	* testsuite/20_util/optional/range.cc: Update tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: optional&lt;T&amp;&gt; for function and unbounded array should not be range [PR122396]</title>
<updated>2025-11-12T08:24:09+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-11-06T14:22:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=d554b8a704bae6c3470fbf44a95559fc26bc75d1'/>
<id>d554b8a704bae6c3470fbf44a95559fc26bc75d1</id>
<content type='text'>
This implements proposed resolution for LWG4308 [1].

For T denoting either function type or unbounded array, the optional&lt;T&amp;&gt; 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&lt;T&amp;&gt; 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&lt;_Tp&amp;&gt;): Inherit from __optional_ref_base&lt;_Tp&gt;.
	(optional&lt;_Tp&amp;&gt;::iterator): Move to base class.
	(optional&lt;_Tp&amp;&gt;::begin, optional&lt;_Tp&amp;&gt;::end): Use deduced return
	type and constrain accordingly.
	* testsuite/20_util/optional/range.cc: Add test for optional&lt;T&amp;&gt;.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements proposed resolution for LWG4308 [1].

For T denoting either function type or unbounded array, the optional&lt;T&amp;&gt; 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&lt;T&amp;&gt; 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&lt;_Tp&amp;&gt;): Inherit from __optional_ref_base&lt;_Tp&gt;.
	(optional&lt;_Tp&amp;&gt;::iterator): Move to base class.
	(optional&lt;_Tp&amp;&gt;::begin, optional&lt;_Tp&amp;&gt;::end): Use deduced return
	type and constrain accordingly.
	* testsuite/20_util/optional/range.cc: Add test for optional&lt;T&amp;&gt;.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Implement optional&lt;T&amp;&gt; from P2988R12 [PR121748]</title>
<updated>2025-10-22T07:53:04+00:00</updated>
<author>
<name>Giuseppe D'Angelo</name>
<email>giuseppe.dangelo@kdab.com</email>
</author>
<published>2025-10-22T07:31:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=23657d3972605542b02a33e67edcc74a7eede02c'/>
<id>23657d3972605542b02a33e67edcc74a7eede02c</id>
<content type='text'>
This patch implements optional&lt;T&amp;&gt; based on the P2988R12 paper, incorporating
corrections from LWG4300, LWG4304, and LWG3467. The resolution for LWG4015
is also extended to cover optional&lt;T&amp;&gt;.

We introduce _M_fwd() helper, that is equivalent to operator*(), except that
it does not check non-empty precondition. It is used in to correctly propagate
the value during move construction from optional&lt;T&amp;&gt;. This is necessary because
moving an optional&lt;T&amp;&gt; must not move the contained object, which is the key
distinction between *std::move(opt) and std::move(*opt).

The implementation deviates from the standard by providing a separate std::swap
overload for std::optional&lt;T&amp;&gt;, which simplifies preserving the resolution of
LWG2766.

This introduces a few changes to make_optional behavior (see included test):
* some previously valid uses of make_optional&lt;T&gt;({...}) (where T is not a
  reference type) now become ill-formed (see optional/make_optional_neg.cc).
* make_optional&lt;T&amp;&gt;(t) and make_optional&lt;const T&amp;&gt;(ct), where decltype(t) is T&amp;,
  and decltype(ct) is const T&amp; now produce optional&lt;T&amp;&gt; and optional&lt;const T&amp;&gt;
  respectively, instead of optional&lt;T&gt;.
* a few other uses of make_optional&lt;R&gt; with reference type R are now ill-formed.

	PR libstdc++/121748

libstdc++-v3/ChangeLog:

	* include/bits/version.def: Bump value for optional,
	* include/bits/version.h: Regenerate.
	* include/std/optional (std::__is_valid_contained_type_for_optional):
	Define.
	(std::optional&lt;T&gt;): Use __is_valid_contained_type_for_optional.
	(optional&lt;T&gt;(const optional&lt;_Up&gt;&amp;), optional&lt;T&gt;(optional&lt;_Up&gt;&amp;&amp;))
	(optional&lt;T&gt;::operator=(const optional&lt;_Up&gt;&amp;))
	(optional&lt;T&gt;::operator=(optional&lt;_Up&gt;&amp;&amp;)): Replacex._M_get() with
	x._M_fwd(), and std::move(x._M_get()) with std::move(x)._M_fwd().
	(optional&lt;T&gt;::and_then): Remove uncessary remove_cvref_t.
	(optional&lt;T&gt;::_M_fwd): Define.
	(std::optional&lt;T&amp;&gt;): Define new partial specialization.
	(std::swap(std::optional&lt;T&amp;&gt;, std::optional&lt;T&amp;&gt;)): Define.
	(std::make_optional(_Tp&amp;&amp;)): Add non-type template parameter.
	(std::make_optional): Use parenthesis to constructor optional.
	(std::hash&lt;optional&lt;T&gt;&gt;): Add comment.
	* testsuite/20_util/optional/make_optional-2.cc: Guarded not longer
	working example.
	* testsuite/20_util/optional/relops/constrained.cc: Expand test to
	cover optionals of reference.
	* testsuite/20_util/optional/requirements.cc: Ammend for
	optional&lt;T&amp;&gt;.
	* testsuite/20_util/optional/requirements_neg.cc: Likewise.
	* testsuite/20_util/optional/version.cc: Test new value of
	__cpp_lib_optional.
	* testsuite/20_util/optional/make_optional_neg.cc: New test.
	* testsuite/20_util/optional/monadic/ref_neg.cc: New test.
	* testsuite/20_util/optional/ref/access.cc: New test.
	* testsuite/20_util/optional/ref/assign.cc: New test.
	* testsuite/20_util/optional/ref/cons.cc: New test.
	* testsuite/20_util/optional/ref/internal_traits.cc: New test.
	* testsuite/20_util/optional/ref/make_optional/1.cc: New test.
	* testsuite/20_util/optional/ref/make_optional/from_args_neg.cc:
	New test.
	* testsuite/20_util/optional/ref/make_optional/from_lvalue_neg.cc:
	New test.
	* testsuite/20_util/optional/ref/make_optional/from_rvalue_neg.cc:
	New test.
	* testsuite/20_util/optional/ref/monadic.cc: New test.
	* testsuite/20_util/optional/ref/relops.cc: New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Co-authored-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch implements optional&lt;T&amp;&gt; based on the P2988R12 paper, incorporating
corrections from LWG4300, LWG4304, and LWG3467. The resolution for LWG4015
is also extended to cover optional&lt;T&amp;&gt;.

We introduce _M_fwd() helper, that is equivalent to operator*(), except that
it does not check non-empty precondition. It is used in to correctly propagate
the value during move construction from optional&lt;T&amp;&gt;. This is necessary because
moving an optional&lt;T&amp;&gt; must not move the contained object, which is the key
distinction between *std::move(opt) and std::move(*opt).

The implementation deviates from the standard by providing a separate std::swap
overload for std::optional&lt;T&amp;&gt;, which simplifies preserving the resolution of
LWG2766.

This introduces a few changes to make_optional behavior (see included test):
* some previously valid uses of make_optional&lt;T&gt;({...}) (where T is not a
  reference type) now become ill-formed (see optional/make_optional_neg.cc).
* make_optional&lt;T&amp;&gt;(t) and make_optional&lt;const T&amp;&gt;(ct), where decltype(t) is T&amp;,
  and decltype(ct) is const T&amp; now produce optional&lt;T&amp;&gt; and optional&lt;const T&amp;&gt;
  respectively, instead of optional&lt;T&gt;.
* a few other uses of make_optional&lt;R&gt; with reference type R are now ill-formed.

	PR libstdc++/121748

libstdc++-v3/ChangeLog:

	* include/bits/version.def: Bump value for optional,
	* include/bits/version.h: Regenerate.
	* include/std/optional (std::__is_valid_contained_type_for_optional):
	Define.
	(std::optional&lt;T&gt;): Use __is_valid_contained_type_for_optional.
	(optional&lt;T&gt;(const optional&lt;_Up&gt;&amp;), optional&lt;T&gt;(optional&lt;_Up&gt;&amp;&amp;))
	(optional&lt;T&gt;::operator=(const optional&lt;_Up&gt;&amp;))
	(optional&lt;T&gt;::operator=(optional&lt;_Up&gt;&amp;&amp;)): Replacex._M_get() with
	x._M_fwd(), and std::move(x._M_get()) with std::move(x)._M_fwd().
	(optional&lt;T&gt;::and_then): Remove uncessary remove_cvref_t.
	(optional&lt;T&gt;::_M_fwd): Define.
	(std::optional&lt;T&amp;&gt;): Define new partial specialization.
	(std::swap(std::optional&lt;T&amp;&gt;, std::optional&lt;T&amp;&gt;)): Define.
	(std::make_optional(_Tp&amp;&amp;)): Add non-type template parameter.
	(std::make_optional): Use parenthesis to constructor optional.
	(std::hash&lt;optional&lt;T&gt;&gt;): Add comment.
	* testsuite/20_util/optional/make_optional-2.cc: Guarded not longer
	working example.
	* testsuite/20_util/optional/relops/constrained.cc: Expand test to
	cover optionals of reference.
	* testsuite/20_util/optional/requirements.cc: Ammend for
	optional&lt;T&amp;&gt;.
	* testsuite/20_util/optional/requirements_neg.cc: Likewise.
	* testsuite/20_util/optional/version.cc: Test new value of
	__cpp_lib_optional.
	* testsuite/20_util/optional/make_optional_neg.cc: New test.
	* testsuite/20_util/optional/monadic/ref_neg.cc: New test.
	* testsuite/20_util/optional/ref/access.cc: New test.
	* testsuite/20_util/optional/ref/assign.cc: New test.
	* testsuite/20_util/optional/ref/cons.cc: New test.
	* testsuite/20_util/optional/ref/internal_traits.cc: New test.
	* testsuite/20_util/optional/ref/make_optional/1.cc: New test.
	* testsuite/20_util/optional/ref/make_optional/from_args_neg.cc:
	New test.
	* testsuite/20_util/optional/ref/make_optional/from_lvalue_neg.cc:
	New test.
	* testsuite/20_util/optional/ref/make_optional/from_rvalue_neg.cc:
	New test.
	* testsuite/20_util/optional/ref/monadic.cc: New test.
	* testsuite/20_util/optional/ref/relops.cc: New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Co-authored-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Add comments to deleted std::swap overloads for LWG 2766</title>
<updated>2025-07-14T20:41:37+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-07-13T14:34:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=9840a1db02cb96011f90b8ee86ca2d23b41781db'/>
<id>9840a1db02cb96011f90b8ee86ca2d23b41781db</id>
<content type='text'>
We pre-emptively implemented part of LWG 2766, which still hasn't been
approved. Add comments to the deleted swap overloads saying why they're
there, because the standard doesn't require them.

libstdc++-v3/ChangeLog:

	* include/bits/stl_pair.h (swap): Add comment to deleted
	overload.
	* include/bits/unique_ptr.h (swap): Likewise.
	* include/std/array (swap): Likewise.
	* include/std/optional (swap): Likewise.
	* include/std/tuple (swap): Likewise.
	* include/std/variant (swap): Likewise.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc:
	Adjust dg-error line numbers.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We pre-emptively implemented part of LWG 2766, which still hasn't been
approved. Add comments to the deleted swap overloads saying why they're
there, because the standard doesn't require them.

libstdc++-v3/ChangeLog:

	* include/bits/stl_pair.h (swap): Add comment to deleted
	overload.
	* include/bits/unique_ptr.h (swap): Likewise.
	* include/std/array (swap): Likewise.
	* include/std/optional (swap): Likewise.
	* include/std/tuple (swap): Likewise.
	* include/std/variant (swap): Likewise.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc:
	Adjust dg-error line numbers.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: add a workaround for format_kind&lt;optional&lt;T&gt;&gt; [PR120644]</title>
<updated>2025-06-13T13:20:18+00:00</updated>
<author>
<name>Giuseppe D'Angelo</name>
<email>giuseppe.dangelo@kdab.com</email>
</author>
<published>2025-06-13T09:38:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=f6f4efdf397269793167fb1303967e7ad0e467a7'/>
<id>f6f4efdf397269793167fb1303967e7ad0e467a7</id>
<content type='text'>
The specialization of format_kind for optional is causing a problem when
optional is imported and included. The comments on the PR strongly
suggest that this is a frontend bug; this commit just works around the
issue by specifying the type of format_kind&lt;optional&lt;T&gt;&gt; to be
`range_format`, rather than leaving the compiler deduce it via `auto`.

	PR c++/120644

libstdc++-v3/ChangeLog:

	* include/std/optional (format_kind): Do not use `auto`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The specialization of format_kind for optional is causing a problem when
optional is imported and included. The comments on the PR strongly
suggest that this is a frontend bug; this commit just works around the
issue by specifying the type of format_kind&lt;optional&lt;T&gt;&gt; to be
`range_format`, rather than leaving the compiler deduce it via `auto`.

	PR c++/120644

libstdc++-v3/ChangeLog:

	* include/std/optional (format_kind): Do not use `auto`.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: add range support to std::optional (P3168)</title>
<updated>2025-06-12T16:29:37+00:00</updated>
<author>
<name>Giuseppe D'Angelo</name>
<email>giuseppe.dangelo@kdab.com</email>
</author>
<published>2025-06-09T21:13:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=774ae8734f0e199a8c6d29dd8c186b893385470b'/>
<id>774ae8734f0e199a8c6d29dd8c186b893385470b</id>
<content type='text'>
This commit implements P3168 ("Give std::optional Range Support"), added
for C++26. Both begin() and end() are straightforward, implemented using
normal_iterator over a raw pointer.

std::optional is also a view, so specialize enable_view for it.

We also need to disable automatic formatting a std::optional as a range
by specializing format_kind. In order to avoid dragging &lt;format&gt; when
including &lt;optional&gt;, I've isolated format_kind and some supporting code
into &lt;bits/formatfwd.h&gt; so that I can use that (comparatively) lighter
header.

libstdc++-v3/ChangeLog:

	* include/bits/formatfwd.h (format_kind): Move the definition
	(and some supporting code) from &lt;format&gt;.
	* include/std/format (format_kind): Likewise.
	* include/bits/version.def (optional_range_support): Add
	the feature-testing macro.
	* include/bits/version.h: Regenerate.
	* include/std/optional (iterator, const_iterator, begin, end):
	Add range support.
	(enable_view): Specialize for std::optional.
	(format_kind): Specialize for std::optional.
	* testsuite/20_util/optional/range.cc: New test.
	* testsuite/20_util/optional/version.cc: Test the new
	feature-testing macro.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit implements P3168 ("Give std::optional Range Support"), added
for C++26. Both begin() and end() are straightforward, implemented using
normal_iterator over a raw pointer.

std::optional is also a view, so specialize enable_view for it.

We also need to disable automatic formatting a std::optional as a range
by specializing format_kind. In order to avoid dragging &lt;format&gt; when
including &lt;optional&gt;, I've isolated format_kind and some supporting code
into &lt;bits/formatfwd.h&gt; so that I can use that (comparatively) lighter
header.

libstdc++-v3/ChangeLog:

	* include/bits/formatfwd.h (format_kind): Move the definition
	(and some supporting code) from &lt;format&gt;.
	* include/std/format (format_kind): Likewise.
	* include/bits/version.def (optional_range_support): Add
	the feature-testing macro.
	* include/bits/version.h: Regenerate.
	* include/std/optional (iterator, const_iterator, begin, end):
	Add range support.
	(enable_view): Specialize for std::optional.
	(format_kind): Specialize for std::optional.
	* testsuite/20_util/optional/range.cc: New test.
	* testsuite/20_util/optional/version.cc: Test the new
	feature-testing macro.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Improve optional's &lt;=&gt; constraint recursion workaround [PR104606]</title>
<updated>2025-02-28T15:15:45+00:00</updated>
<author>
<name>Patrick Palka</name>
<email>ppalka@redhat.com</email>
</author>
<published>2025-02-28T15:15:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=815f1f27a1dba2f0acd1f02d0beafedadebe967c'/>
<id>815f1f27a1dba2f0acd1f02d0beafedadebe967c</id>
<content type='text'>
It turns out the reason the behavior of this testcase changed after CWG
2369 is because validity of the substituted return type is now checked
later, after constraints.  So a more reliable workaround for this issue
is to add a constraint to check the validity of the return type earlier,
matching the pre-CWG 2369 semantics.

	PR libstdc++/104606

libstdc++-v3/ChangeLog:

	* include/std/optional (operator&lt;=&gt;): Revert r14-9771 change.
	Add constraint checking the validity of the return type
	compare_three_way_result_t before the three_way_comparable_with
	constraint.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It turns out the reason the behavior of this testcase changed after CWG
2369 is because validity of the substituted return type is now checked
later, after constraints.  So a more reliable workaround for this issue
is to add a constraint to check the validity of the return type earlier,
matching the pre-CWG 2369 semantics.

	PR libstdc++/104606

libstdc++-v3/ChangeLog:

	* include/std/optional (operator&lt;=&gt;): Revert r14-9771 change.
	Add constraint checking the validity of the return type
	compare_three_way_result_t before the three_way_comparable_with
	constraint.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright years.</title>
<updated>2025-01-02T10:59:57+00:00</updated>
<author>
<name>Jakub Jelinek</name>
<email>jakub@redhat.com</email>
</author>
<published>2025-01-02T10:59:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=6441eb6dc020faae0672ea724dfdb38c6a9bf6a1'/>
<id>6441eb6dc020faae0672ea724dfdb38c6a9bf6a1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
