[Mlir-commits] [mlir] [MLIR][Python] Add bindings for PDL native rewrite function registering (PR #159926)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 23 07:16:37 PDT 2025


================
@@ -53,7 +53,7 @@ public:
   /// value is not an instance of `T`.
   template <typename T,
             typename ResultT = std::conditional_t<
-                std::is_convertible<T, bool>::value, T, std::optional<T>>>
+                std::is_constructible_v<bool, T>, T, std::optional<T>>>
----------------
PragmaTwice wrote:

Some classes like `mlir::Value`, `mlir::Type` .. have an `explicit operator bool()`, and `is_convertible` will ignore explicit conversions. So here we replace it with `is_constructible_v` to make it work for these types, so that `std::optional` is not needed now.

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


More information about the Mlir-commits mailing list