[llvm] [ADT] Specialize ValueIsPresent for PointerUnion (PR #121847)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 16:41:27 PST 2025


================
@@ -614,12 +610,11 @@ template <typename T> struct ValueIsPresent<std::optional<T>> {
   static inline decltype(auto) unwrapValue(std::optional<T> &t) { return *t; }
 };
 
-// If something is "nullable" then we just compare it to nullptr to see if it
-// exists.
+// Specialization for types convertible to bool.
 template <typename T>
-struct ValueIsPresent<T, std::enable_if_t<IsNullable<T>>> {
+struct ValueIsPresent<T, std::enable_if_t<std::is_constructible_v<bool, T>>> {
----------------
kuhar wrote:

But this enable_if guards both `isPresent` and `unwrapValue` -- don't we need extra care for the latter?

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


More information about the llvm-commits mailing list