<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/libstdc++-v3/include, 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++: Implement P3223R2 Making std::istream::ignore less surprising</title>
<updated>2025-11-21T15:30:50+00:00</updated>
<author>
<name>Yuao Ma</name>
<email>c8ef@outlook.com</email>
</author>
<published>2025-11-02T07:39:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=0d4ab66aaf1f2ade8b6deab07f37b3137f5f5763'/>
<id>0d4ab66aaf1f2ade8b6deab07f37b3137f5f5763</id>
<content type='text'>
libstdc++-v3/ChangeLog:

	* include/std/istream (ignore): Add an overload for char.
	* testsuite/27_io/basic_istream/ignore/char/93672.cc: Adjust
	expected behaviour for C++26 mode.
	* testsuite/27_io/basic_istream/ignore/char/4.cc: New test.

Co-authored-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
libstdc++-v3/ChangeLog:

	* include/std/istream (ignore): Add an overload for char.
	* testsuite/27_io/basic_istream/ignore/char/93672.cc: Adjust
	expected behaviour for C++26 mode.
	* testsuite/27_io/basic_istream/ignore/char/4.cc: New test.

Co-authored-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Include &lt;ostream&gt; in &lt;regex&gt; for debug mode</title>
<updated>2025-11-21T15:30:49+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-11-21T12:02:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=e8cf136b1a281db54edf5f824e8b08e5b757269f'/>
<id>e8cf136b1a281db54edf5f824e8b08e5b757269f</id>
<content type='text'>
I don't know what changed, but I'm seeing some new failures:

FAIL: 23_containers/vector/capacity/114945.cc  -std=gnu++11 (test for excess errors)
FAIL: 23_containers/vector/capacity/114945.cc  -std=gnu++14 (test for excess errors)
FAIL: 23_containers/vector/capacity/114945.cc  -std=gnu++17 (test for excess errors)
FAIL: 28_regex/basic_regex/85098.cc  -std=gnu++11 (test for excess errors)
FAIL: 28_regex/basic_regex/85098.cc  -std=gnu++14 (test for excess errors)
FAIL: 28_regex/basic_regex/85098.cc  -std=gnu++17 (test for excess errors)
FAIL: 28_regex/simple_c++11.cc   (test for excess errors)

libstdc++-v3/ChangeLog:

	* include/bits/regex_automaton.tcc [_GLIBCXX_DEBUG]: Include
	&lt;ostream&gt; so that _State_base::_M_print etc. can use it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I don't know what changed, but I'm seeing some new failures:

FAIL: 23_containers/vector/capacity/114945.cc  -std=gnu++11 (test for excess errors)
FAIL: 23_containers/vector/capacity/114945.cc  -std=gnu++14 (test for excess errors)
FAIL: 23_containers/vector/capacity/114945.cc  -std=gnu++17 (test for excess errors)
FAIL: 28_regex/basic_regex/85098.cc  -std=gnu++11 (test for excess errors)
FAIL: 28_regex/basic_regex/85098.cc  -std=gnu++14 (test for excess errors)
FAIL: 28_regex/basic_regex/85098.cc  -std=gnu++17 (test for excess errors)
FAIL: 28_regex/simple_c++11.cc   (test for excess errors)

libstdc++-v3/ChangeLog:

	* include/bits/regex_automaton.tcc [_GLIBCXX_DEBUG]: Include
	&lt;ostream&gt; so that _State_base::_M_print etc. can use it.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: [_GLIBCXX_DEBUG] Fix std::erase_if behavior for __gnu_debug::vector</title>
<updated>2025-11-20T18:10:20+00:00</updated>
<author>
<name>François Dumont</name>
<email>frs.dumont@gmail.com</email>
</author>
<published>2025-11-20T06:01:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=e166a0f5ee619f3f97107024ae4671dff9708507'/>
<id>e166a0f5ee619f3f97107024ae4671dff9708507</id>
<content type='text'>
When using directly __gnu_debug::vector the std::erase_if is called with a
reference to the std::vector base class and so is missing the invalidation
of the iterators implied by this operation.

To fix this provide a std::erase_if overload dedicated to __gnu_debug::vector.
Doing so we can cleanup the implementation dedicated to std::vector from any
_GLIBCXX_DEBUG consideration.

libstdc++-v3/ChangeLog:

	* include/debug/vector (std::erase_if, std::erase): New overloads for
	std::__debug::vector instances.
	* include/std/vector (std::erase_if, std::erase): Make overloads specific
	to normal std::vector implementation.
	* testsuite/23_containers/vector/debug/erase.cc: New test case.
	* testsuite/23_containers/vector/debug/invalidation/erase.cc: New test case.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When using directly __gnu_debug::vector the std::erase_if is called with a
reference to the std::vector base class and so is missing the invalidation
of the iterators implied by this operation.

To fix this provide a std::erase_if overload dedicated to __gnu_debug::vector.
Doing so we can cleanup the implementation dedicated to std::vector from any
_GLIBCXX_DEBUG consideration.

libstdc++-v3/ChangeLog:

	* include/debug/vector (std::erase_if, std::erase): New overloads for
	std::__debug::vector instances.
	* include/std/vector (std::erase_if, std::erase): Make overloads specific
	to normal std::vector implementation.
	* testsuite/23_containers/vector/debug/erase.cc: New test case.
	* testsuite/23_containers/vector/debug/invalidation/erase.cc: New test case.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Prepare mdspan-related code for submdspan.</title>
<updated>2025-11-20T16:21:05+00:00</updated>
<author>
<name>Luc Grosheintz</name>
<email>luc.grosheintz@gmail.com</email>
</author>
<published>2025-11-18T14:24:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=828ac566b7c6356ff94dc6153b278b8e0fa26981'/>
<id>828ac566b7c6356ff94dc6153b278b8e0fa26981</id>
<content type='text'>
The changes needed for submdspan are:

  * In submdspan related code the user-defined integer-like
    types need to be copy- and move-constructable.

  * The traits for writing tests that work with both left- and right,
    possibly padded, layouts will also be useful for submdspan.
    Therefore, this code is moved up and generalized.

  * Move __offset further up in &lt;mdspan&gt; and fix some formatting
    mistakes.

libstdc++-v3/ChangeLog:

	* include/std/mdspan: Improve formatting and placement.
	* testsuite/23_containers/mdspan/int_like.h: Optionally,
	add move- and copy-ctors.
	* testsuite/23_containers/mdspan/layouts/padded_traits.h: Move to...
	* testsuite/23_containers/mdspan/layout_traits.h: ...here.
	* testsuite/23_containers/mdspan/layouts/ctors.cc: Fix include.
	* testsuite/23_containers/mdspan/layouts/mapping.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded_neg.cc: Ditto.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Signed-off-by: Luc Grosheintz &lt;luc.grosheintz@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The changes needed for submdspan are:

  * In submdspan related code the user-defined integer-like
    types need to be copy- and move-constructable.

  * The traits for writing tests that work with both left- and right,
    possibly padded, layouts will also be useful for submdspan.
    Therefore, this code is moved up and generalized.

  * Move __offset further up in &lt;mdspan&gt; and fix some formatting
    mistakes.

libstdc++-v3/ChangeLog:

	* include/std/mdspan: Improve formatting and placement.
	* testsuite/23_containers/mdspan/int_like.h: Optionally,
	add move- and copy-ctors.
	* testsuite/23_containers/mdspan/layouts/padded_traits.h: Move to...
	* testsuite/23_containers/mdspan/layout_traits.h: ...here.
	* testsuite/23_containers/mdspan/layouts/ctors.cc: Fix include.
	* testsuite/23_containers/mdspan/layouts/mapping.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded_neg.cc: Ditto.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Signed-off-by: Luc Grosheintz &lt;luc.grosheintz@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: store the length after the store of the null character</title>
<updated>2025-11-19T17:14:05+00:00</updated>
<author>
<name>Andrew Pinski</name>
<email>andrew.pinski@oss.qualcomm.com</email>
</author>
<published>2025-11-18T20:57:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=47ebad54abc127934693e7ace75a3cb08d6bc36c'/>
<id>47ebad54abc127934693e7ace75a3cb08d6bc36c</id>
<content type='text'>
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 &lt;andrew.pinski@oss.qualcomm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;andrew.pinski@oss.qualcomm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Make &lt;mdspan&gt; compatible with clang.</title>
<updated>2025-11-19T14:47:11+00:00</updated>
<author>
<name>Luc Grosheintz</name>
<email>luc.grosheintz@gmail.com</email>
</author>
<published>2025-11-19T13:52:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=58b88748e6bf651d425ae11d143d02a29575186b'/>
<id>58b88748e6bf651d425ae11d143d02a29575186b</id>
<content type='text'>
These three changes are needed to make &lt;mdspan&gt; 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&lt;double&gt;.

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 &lt;jwakely@redhat.com&gt;
Signed-off-by: Luc Grosheintz &lt;luc.grosheintz@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These three changes are needed to make &lt;mdspan&gt; 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&lt;double&gt;.

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 &lt;jwakely@redhat.com&gt;
Signed-off-by: Luc Grosheintz &lt;luc.grosheintz@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>c++, libstdc++: Implement CWG1670 and LWG4468</title>
<updated>2025-11-19T10:03:07+00:00</updated>
<author>
<name>Jakub Jelinek</name>
<email>jakub@redhat.com</email>
</author>
<published>2025-11-19T10:02:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=3d000da53203c9f17b29dd9328d12dfcbe8d03aa'/>
<id>3d000da53203c9f17b29dd9328d12dfcbe8d03aa</id>
<content type='text'>
The following patch attempts to implement CWG1670 and related LWG4468.

2025-11-19  Jakub Jelinek  &lt;jakub@redhat.com&gt;

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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The following patch attempts to implement CWG1670 and related LWG4468.

2025-11-19  Jakub Jelinek  &lt;jakub@redhat.com&gt;

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.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: shared_mutex: Respond consistently to errors and deadlock</title>
<updated>2025-11-18T17:13:44+00:00</updated>
<author>
<name>Mike Crowe</name>
<email>mac@mcrowe.com</email>
</author>
<published>2025-11-18T13:06:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=a39fec8c74c8cd58754053dba807d68e2398ca83'/>
<id>a39fec8c74c8cd58754053dba807d68e2398ca83</id>
<content type='text'>
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 &amp; 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 &lt;mac@mcrowe.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &amp; 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 &lt;mac@mcrowe.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Fix construction function_ref from nontype&lt;&amp;S::x&gt; and reference_wrapper [PR121858]</title>
<updated>2025-11-18T10:51:16+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-10-24T14:45:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=ac45382d0c06bc1a90ce74e0379e52496ab3bffe'/>
<id>ac45382d0c06bc1a90ce74e0379e52496ab3bffe</id>
<content type='text'>
To reduce instantiation count, function_ref(nontype&lt;&amp;S::x&gt;, r) previously
reused the invoker from function_ref(nontype&lt;&amp;S::x&gt;, &amp;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&lt;_Td&gt;::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&lt;__fn&gt;, _Up&amp;&amp;)): Handle.
	reference_wrapper.
	* testsuite/20_util/function_ref/call.cc: Call and update
	test05(). Add new test06() for reference_wrapper.

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>
To reduce instantiation count, function_ref(nontype&lt;&amp;S::x&gt;, r) previously
reused the invoker from function_ref(nontype&lt;&amp;S::x&gt;, &amp;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&lt;_Td&gt;::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&lt;__fn&gt;, _Up&amp;&amp;)): Handle.
	reference_wrapper.
	* testsuite/20_util/function_ref/call.cc: Call and update
	test05(). Add new test06() for reference_wrapper.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
