[Mlir-commits] [mlir] 669f4bc - [mlir][SubElements] Disambiguate cast<> call for MSVC

Benjamin Kramer llvmlistbot at llvm.org
Tue Jan 31 07:54:53 PST 2023


Author: Benjamin Kramer
Date: 2023-01-31T16:54:40+01:00
New Revision: 669f4bc558b7a3dec21bf1045bff5f3885838182

URL: https://github.com/llvm/llvm-project/commit/669f4bc558b7a3dec21bf1045bff5f3885838182
DIFF: https://github.com/llvm/llvm-project/commit/669f4bc558b7a3dec21bf1045bff5f3885838182.diff

LOG: [mlir][SubElements] Disambiguate cast<> call for MSVC

For some reason MSVC selects Attribute::cast here, and then fails to
call it because it takes no arguments. Feels like a generic lambda compiler
bug.

mlir/include\mlir/IR/StorageUniquerSupport.h(135): error C2672: 'mlir::Attribute::cast': no matching overloaded function found

Added: 
    

Modified: 
    mlir/include/mlir/IR/StorageUniquerSupport.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/StorageUniquerSupport.h b/mlir/include/mlir/IR/StorageUniquerSupport.h
index 333618bc72455..2e8b457f9fe6a 100644
--- a/mlir/include/mlir/IR/StorageUniquerSupport.h
+++ b/mlir/include/mlir/IR/StorageUniquerSupport.h
@@ -132,8 +132,8 @@ class StorageUserBase : public BaseT, public Traits<ConcreteT>... {
   static auto getWalkImmediateSubElementsFn() {
     return [](auto instance, function_ref<void(Attribute)> walkAttrsFn,
               function_ref<void(Type)> walkTypesFn) {
-      ::mlir::detail::walkImmediateSubElementsImpl(cast<ConcreteT>(instance),
-                                                   walkAttrsFn, walkTypesFn);
+      ::mlir::detail::walkImmediateSubElementsImpl(
+          llvm::cast<ConcreteT>(instance), walkAttrsFn, walkTypesFn);
     };
   }
 
@@ -143,7 +143,7 @@ class StorageUserBase : public BaseT, public Traits<ConcreteT>... {
     return [](auto instance, ArrayRef<Attribute> replAttrs,
               ArrayRef<Type> replTypes) {
       return ::mlir::detail::replaceImmediateSubElementsImpl(
-          cast<ConcreteT>(instance), replAttrs, replTypes);
+          llvm::cast<ConcreteT>(instance), replAttrs, replTypes);
     };
   }
 


        


More information about the Mlir-commits mailing list