[libcxx-commits] [libcxx] ac7d60f - [libc++] Fixes use-after move diagnostic.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 31 08:21:50 PDT 2023


Author: Mark de Wever
Date: 2023-05-31T17:21:38+02:00
New Revision: ac7d60f73a4a369fb4dcce734d54cb38fde80981

URL: https://github.com/llvm/llvm-project/commit/ac7d60f73a4a369fb4dcce734d54cb38fde80981
DIFF: https://github.com/llvm/llvm-project/commit/ac7d60f73a4a369fb4dcce734d54cb38fde80981.diff

LOG: [libc++] Fixes use-after move diagnostic.

The diagnostic is issued by clang-tidy 17.

This just suppressed the diagnostic. The move operations are non-standard extensions and the class itself is deprecated.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D151223

Added: 
    

Modified: 
    libcxx/include/strstream

Removed: 
    


################################################################################
diff  --git a/libcxx/include/strstream b/libcxx/include/strstream
index 01590445fea68..594353bac426c 100644
--- a/libcxx/include/strstream
+++ b/libcxx/include/strstream
@@ -256,8 +256,8 @@ public:
 
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
-    istrstream(istrstream&& __rhs)
-        : istream(_VSTD::move(__rhs)),
+    istrstream(istrstream&& __rhs)  // extension
+        : istream(_VSTD::move(static_cast<istream&>(__rhs))),
           __sb_(_VSTD::move(__rhs.__sb_))
     {
         istream::set_rdbuf(&__sb_);
@@ -305,8 +305,8 @@ public:
 
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
-    ostrstream(ostrstream&& __rhs)
-        : ostream(_VSTD::move(__rhs)),
+    ostrstream(ostrstream&& __rhs)  // extension
+        : ostream(_VSTD::move(static_cast<ostream&>(__rhs))),
           __sb_(_VSTD::move(__rhs.__sb_))
     {
         ostream::set_rdbuf(&__sb_);
@@ -365,8 +365,8 @@ public:
 
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
-    strstream(strstream&& __rhs)
-        : iostream(_VSTD::move(__rhs)),
+    strstream(strstream&& __rhs)  // extension
+        : iostream(_VSTD::move(static_cast<iostream&>(__rhs))),
           __sb_(_VSTD::move(__rhs.__sb_))
     {
         iostream::set_rdbuf(&__sb_);


        


More information about the libcxx-commits mailing list