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

via cfe-commits cfe-commits at lists.llvm.org
Fri May 31 10:23:17 PDT 2024


Author: David Stone
Date: 2024-05-31T19:23:14+02:00
New Revision: 41ddf128ea2ecfe0c418d2dfb5bbf99538498750

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

LOG: Remove dangling conversion to `optional<T> &` (#93385)

Added: 
    

Modified: 
    clang/include/clang/Basic/CustomizableOptional.h

Removed: 
    


################################################################################
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