[clang] Remove dangling conversion to `optional<T> &` (PR #93385)

via cfe-commits cfe-commits at lists.llvm.org
Sat May 25 13:35:36 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: David Stone (davidstone)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) clang/include/clang/Basic/CustomizableOptional.h (-8) 


``````````diff
diff --git a/clang/include/clang/Basic/CustomizableOptional.h b/clang/include/clang/Basic/CustomizableOptional.h
index 84d40025ee41b..2d6ae6a781a55 100644
--- a/clang/include/clang/Basic/CustomizableOptional.h
+++ b/clang/include/clang/Basic/CustomizableOptional.h
@@ -97,14 +97,6 @@ template <typename T> class CustomizableOptional {
   template <typename U> T value_or(U &&alt) && {
     return has_value() ? std::move(operator*()) : std::forward<U>(alt);
   }
-
-  // Allow conversion to std::optional<T>.
-  explicit operator std::optional<T> &() const & {
-    return *this ? **this : std::optional<T>();
-  }
-  explicit operator std::optional<T> &&() const && {
-    return *this ? std::move(**this) : std::optional<T>();
-  }
 };
 
 template <typename T>

``````````

</details>


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


More information about the cfe-commits mailing list