[Mlir-commits] [mlir] [mlir][IR] Avoid Clang 21 crash during SFINAE overload resolution (PR #208359)

Kazu Hirata llvmlistbot at llvm.org
Thu Jul 9 07:53:46 PDT 2026


================
@@ -194,9 +194,16 @@ class StorageUserBase : public BaseT, public Traits<ConcreteT>... {
   /// Get or create a new ConcreteT instance within the ctx. If the arguments
   /// provided are invalid, errors are emitted using the provided `emitError`
   /// and a null object is returned.
-  template <typename... Args>
+  ///
+  /// Workaround: We use Arg1 && instead of MLIRContext * in the parameter list
+  /// to work around a bug in Clang 21.1.8 where Clang segfaults during SFINAE
+  /// overload resolution when attempting to match non-pointer arguments
+  /// against an unconstrained MLIRContext * parameter.
+  template <typename Arg1, typename... Args,
+            typename = std::enable_if_t<std::is_convertible<
----------------
kazutakahirata wrote:

Fixed in the latest iteration.  Thanks!

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


More information about the Mlir-commits mailing list