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

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


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

None

>From 8c2ae501a09df7248117fa7d69cb0621aef14c1f Mon Sep 17 00:00:00 2001
From: David Stone <davidfromonline at gmail.com>
Date: Sat, 25 May 2024 14:32:56 -0600
Subject: [PATCH] Remove dangling conversion to `optional<T> &`

---
 clang/include/clang/Basic/CustomizableOptional.h | 8 --------
 1 file changed, 8 deletions(-)

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>



More information about the cfe-commits mailing list