[Mlir-commits] [mlir] [mlir] fix Undefined behavior in CastInfo::castFailed with From=<MLIRinterface> (PR #87145)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Nov 3 06:23:34 PST 2024


================
@@ -2142,6 +2143,83 @@ struct DenseMapInfo<T,
   }
   static bool isEqual(T lhs, T rhs) { return lhs == rhs; }
 };
+
+/// Add support for llvm style casts.
+/// We provide a cast between To and From if To and From is mlir::OpInterface or
+/// derives from it.
+template <typename To, typename From>
----------------
lipracer wrote:

When I try to relax the condition to `two types derive from OpState`, I encounter the following error:
![Screenshot from 2024-11-03 08-58-36](https://github.com/user-attachments/assets/25d6b5af-a74c-443f-89d4-86d0ee74944c)


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


More information about the Mlir-commits mailing list