[llvm] [Support] Insertion operator should be forwarded, not moved (PR #152326)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 08:36:04 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: AZero13 (AZero13)

<details>
<summary>Changes</summary>

It is a forwarding reference, after all.

---
Full diff: https://github.com/llvm/llvm-project/pull/152326.diff


1 Files Affected:

- (modified) llvm/include/llvm/Support/raw_ostream.h (+1-1) 


``````````diff
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
index f87344e860518d..01e4a1de864958 100644
--- a/llvm/include/llvm/Support/raw_ostream.h
+++ b/llvm/include/llvm/Support/raw_ostream.h
@@ -426,7 +426,7 @@ std::enable_if_t<!std::is_reference_v<OStream> &&
                  OStream &&>
 operator<<(OStream &&OS, const T &Value) {
   OS << Value;
-  return std::move(OS);
+  return std::forward<OStream>(OS);
 }
 
 /// An abstract base class for streams implementations that also support a

``````````

</details>


https://github.com/llvm/llvm-project/pull/152326


More information about the llvm-commits mailing list