I think this was the only part of the recently-approved LWG 4015 changes
which affect our implementation, because we already store the value as a
union member, and already have accessors for that value which are not
prone to the ADL problems solved by changes like replacing *rhs with
rhs.operator*().

libstdc++-v3/ChangeLog:

        * include/std/optional (_Storage::_M_value): Use remove_cv_t for
        type of union member.
---

Tested x86_64-linux.

 libstdc++-v3/include/std/optional | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/optional 
b/libstdc++-v3/include/std/optional
index 39db8d3d4a0f..0f718a22cf18 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -249,7 +249,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
          _Empty_byte _M_empty;
-         _Up _M_value;
+         remove_cv_t<_Up> _M_value;
        };
 
 #if __cpp_concepts < 202002L
@@ -288,7 +288,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          _Storage& operator=(_Storage&&) = default;
 
          _Empty_byte _M_empty;
-         _Up _M_value;
+         remove_cv_t<_Up> _M_value;
        };
 #endif
 
-- 
2.51.1

Reply via email to