diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-11-30 21:37:02 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2024-12-03 10:19:06 +0000 |
commit | 29bea6921d0e2e3dd20bc78926ef0e98b1b1e4ad (patch) | |
tree | 317c2d2dec5fcd46538ed73f875f58b0b19ae351 /libstdc++-v3/include/std | |
parent | 17c9c7c10a70d18dea5849d11a4fa382d3817fa1 (diff) | |
download | gcc-29bea6921d0e2e3dd20bc78926ef0e98b1b1e4ad.zip gcc-29bea6921d0e2e3dd20bc78926ef0e98b1b1e4ad.tar.gz gcc-29bea6921d0e2e3dd20bc78926ef0e98b1b1e4ad.tar.bz2 |
libstdc++: Fix constraints on std::optional converting constructors [PR117889]
The converting constructors had the same bug as the converting
assignments, so need the same fix as r15-5833-gc2c7d71eeeab7c.
libstdc++-v3/ChangeLog:
PR libstdc++/117889
PR libstdc++/117858
* include/std/optional (optional(const optional<U>&)): Fix copy
and paste error in constraints.
(optional(optional<U>&&)): Likewise.
* testsuite/20_util/optional/assignment/117858.cc: Move to ...
* testsuite/20_util/optional/cons/117858.cc: New test.
Diffstat (limited to 'libstdc++-v3/include/std')
-rw-r--r-- | libstdc++-v3/include/std/optional | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 55e56cf..617e441 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -876,7 +876,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _Base(std::in_place, std::forward<_Up>(__t)) { } template<typename _Up> - requires (!is_same_v<optional, remove_cvref_t<_Up>>) + requires (!is_same_v<_Tp, _Up>) && is_constructible_v<_Tp, const _Up&> && __construct_from_contained_value<_Up> constexpr explicit(!is_convertible_v<const _Up&, _Tp>) @@ -888,7 +888,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template<typename _Up> - requires (!is_same_v<optional, remove_cvref_t<_Up>>) + requires (!is_same_v<_Tp, _Up>) && is_constructible_v<_Tp, _Up> && __construct_from_contained_value<_Up> constexpr explicit(!is_convertible_v<_Up, _Tp>) |