Skip to content

Conversation

@jtuyls
Copy link
Contributor

@jtuyls jtuyls commented Dec 24, 2025

Fixes an MSCV build issue after the C++20 fix in #169772. See the failure log in the IREE downstream project.

Making IsRandomAccess, IsBidirectional public ensures that they are always accessible, avoiding the access-related SFINAE ambiguity that causes different compilers to handle this differently.

The build is passing after this change: https://github.com/iree-org/iree/actions/runs/20485132054/job/58865989220?pr=22979

@llvmbot
Copy link
Member

llvmbot commented Dec 24, 2025

@llvm/pr-subscribers-llvm-adt

Author: Jorn Tuyls (jtuyls)

Changes

Fixes an MSCV build issue after the C++20 fix in #169772. See the failure log in the IREE downstream project.

Making IsRandomAccess, IsBidirectional public ensures that they are always accessible, avoiding the access-related SFINAE ambiguity that causes different compilers to handle this differently.

The build is passing after this change: https://github.com/iree-org/iree/actions/runs/20485132054/job/58865989220?pr=22979


Full diff: https://github.com/llvm/llvm-project/pull/173495.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/iterator.h (+5-1)
diff --git a/llvm/include/llvm/ADT/iterator.h b/llvm/include/llvm/ADT/iterator.h
index c0495e24893fb..7444409508b53 100644
--- a/llvm/include/llvm/ADT/iterator.h
+++ b/llvm/include/llvm/ADT/iterator.h
@@ -85,7 +85,9 @@ class iterator_facade_base {
   using pointer = PointerT;
   using reference = ReferenceT;
 
-protected:
+  // Note: These were previously protected, but MSVC has trouble with SFINAE
+  // accessing protected members in derived class templates (specifically in
+  // iterator_adaptor_base::operator-). Making them public fixes the build.
   enum {
     IsRandomAccess = std::is_base_of<std::random_access_iterator_tag,
                                      IteratorCategoryT>::value,
@@ -93,6 +95,8 @@ class iterator_facade_base {
                                       IteratorCategoryT>::value,
   };
 
+protected:
+
   /// A proxy object for computing a reference via indirecting a copy of an
   /// iterator. This is used in APIs which need to produce a reference via
   /// indirection but for which the iterator object might be a temporary. The

@github-actions
Copy link

github-actions bot commented Dec 24, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@jtuyls jtuyls force-pushed the fix-adt-msvc-error branch from 977596b to ddcb06b Compare December 24, 2025 14:20
@jtuyls
Copy link
Contributor Author

jtuyls commented Dec 24, 2025

Cc some of the participants in #169772: @vedranmiletic, @kuhar, @cor3ntin, @jwakely. Could you help review?

@vedranmiletic
Copy link
Contributor

Can you post the failure log here? It is not accessible without authentication.

@vedranmiletic
Copy link
Contributor

@jtuyls @kuhar FWIW, I am wondering if some friend markings would be a less radical option that would satisfy MSVC.

jtuyls added a commit to iree-org/iree that referenced this pull request Dec 26, 2025
Integrate
llvm/llvm-project@c0f4a8a

Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due
to llvm/llvm-project#172932.

Also adds a revert for a commit that breaks the MSVC build:
* Local revert of llvm/llvm-project#169772. This
can be dropped after llvm/llvm-project#173495.

Signed-off-by: Jorn Tuyls <[email protected]>
@jtuyls
Copy link
Contributor Author

jtuyls commented Dec 26, 2025

@jtuyls @kuhar FWIW, I am wondering if some friend markings would be a less radical option that would satisfy MSVC.

That also works, but we need the forward declaration of iterator_adaptor_base and then add it as a friend of iterator_facade_base, which is a bit weird imo because it makes a derived class friend of a parent. And I don't see an issue with making IsRandomAccess and IsBidirectional public as they are just compile-time constants that won't change. So, making them public is the simplest and clearest solution for this issue imo. WDYT?

Here is the diff for the friend solution:

diff --git a/llvm/include/llvm/ADT/iterator.h b/llvm/include/llvm/ADT/iterator.h
index c0495e24893f..852604d36839 100644
--- a/llvm/include/llvm/ADT/iterator.h
+++ b/llvm/include/llvm/ADT/iterator.h
@@ -17,6 +17,12 @@
 
 namespace llvm {
 
+// Forward declaration for friend declaration in iterator_facade_base.
+template <typename DerivedT, typename WrappedIteratorT, typename IteratorCategoryT,
+          typename T, typename DifferenceTypeT, typename PointerT,
+          typename ReferenceT>
+class iterator_adaptor_base;
+
 /// CRTP base class which implements the entire standard iterator facade
 /// in terms of a minimal subset of the interface.
 ///
@@ -78,6 +84,12 @@ template <typename DerivedT, typename IteratorCategoryT, typename T,
           typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *,
           typename ReferenceT = T &>
 class iterator_facade_base {
+  // Grant access to protected IsRandomAccess/IsBidirectional for SFINAE in
+  // iterator_adaptor_base::operator-. Without this, MSVC fails to access these
+  // protected members during template argument substitution.
+  template <typename, typename, typename, typename, typename, typename, typename>
+  friend class iterator_adaptor_base;
+
 public:
   using iterator_category = IteratorCategoryT;
   using value_type = T;

Also, here is a snippet of the failure log btw:

2025-12-24T09:24:04.9349143Z [9006/9574] Building CXX object compiler\src\iree\compiler\API\Internal\CMakeFiles\iree_compiler_API_Internal_IREEMLIRLSPServerToolEntryPoint.objects.dir\IREEMLIRLSPServerToolEntryPoint.cpp.obj
2025-12-24T09:24:04.9350446Z FAILED: compiler/src/iree/compiler/API/Internal/CMakeFiles/iree_compiler_API_Internal_IREEMLIRLSPServerToolEntryPoint.objects.dir/IREEMLIRLSPServerToolEntryPoint.cpp.obj 
2025-12-24T09:24:04.9356922Z C:\ProgramData\chocolatey\bin\ccache "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\cl.exe"  /nologo /TP -DIREE_ALLOCATOR_SYSTEM_CTL=iree_allocator_libc_ctl -DIREE_EMBED_BUILDING_LIBRARY -DIREE_EMBED_ENABLE_WINDOWS_DLL_DECLSPEC -DIREE_HAVE_C_OUTPUT_FORMAT -DIREE_HAVE_HAL_EXECUTABLE_EMBEDDED_ELF_PLUGIN=1 -DIREE_HAVE_HAL_EXECUTABLE_LOADER_EMBEDDED_ELF=1 -DIREE_HAVE_HAL_EXECUTABLE_LOADER_SYSTEM_LIBRARY=1 -DIREE_HAVE_HAL_EXECUTABLE_LOADER_VMVX_MODULE=1 -DIREE_HAVE_HAL_EXECUTABLE_SYSTEM_LIBRARY_PLUGIN=1 -DIREE_HAVE_HAL_LOCAL_TASK_DRIVER_MODULE=1 -DIREE_HAVE_VMVX_MODULE -DMLIR_CAPI_BUILDING_LIBRARY -DMLIR_CAPI_ENABLE_WINDOWS_DLL_DECLSPEC -IC:\home\runner\_work\iree\iree -IB:\tmpbuild -IC:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include -IB:\tmpbuild\llvm-project\include -IC:\home\runner\_work\iree\iree\third_party\llvm-project\mlir\include -IB:\tmpbuild\llvm-project\tools\mlir\include -IC:\home\runner\_work\iree\iree\third_party\llvm-project\lld\include -IB:\tmpbuild\llvm-project\tools\lld\include -IC:\home\runner\_work\iree\iree\compiler\src -IB:\tmpbuild\compiler\src -IC:\home\runner\_work\iree\iree\runtime\src -IB:\tmpbuild\runtime\src -IB:\tmpbuild\runtime\src\iree\base\internal\flatcc -IC:\home\runner\_work\iree\iree\llvm-external-projects\iree-dialects\include -IB:\tmpbuild\llvm-external-projects\mlir-iree-dialects\include -IC:\home\runner\_work\iree\iree\compiler\bindings\c\. -IB:\tmpbuild\compiler\bindings\c\. -IB:\tmpbuild\runtime\src\iree\schemas -IB:\tmpbuild\runtime\src\iree\schemas\instruments -external:IC:\home\runner\_work\iree\iree\third_party\flatcc\include -external:W0 /DWIN32 /D_WINDOWS /EHsc /Z7 /O2 /Ob1  -std:c++17 -MD /Zc:preprocessor /DWIN32_LEAN_AND_MEAN /DNOMINMAX /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES /D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING /GR- /bigobj /W3 /wd4200 /wd4018 /wd4146 /wd4244 /wd4267 /wd4005 /wd4065 /wd4141 /wd4624 /wd4576 /wd5105 -DIREE_THREADING_ENABLE=1 -IC:/home/runner/_work/iree/iree/third_party/flatcc/include/ -IC:/home/runner/_work/iree/iree/third_party/flatcc/include/flatcc/reflection/ /showIncludes /Focompiler\src\iree\compiler\API\Internal\CMakeFiles\iree_compiler_API_Internal_IREEMLIRLSPServerToolEntryPoint.objects.dir\IREEMLIRLSPServerToolEntryPoint.cpp.obj /Fdcompiler\src\iree\compiler\API\Internal\CMakeFiles\iree_compiler_API_Internal_IREEMLIRLSPServerToolEntryPoint.objects.dir\ /FS -c C:\home\runner\_work\iree\iree\compiler\src\iree\compiler\API\Internal\IREEMLIRLSPServerToolEntryPoint.cpp
2025-12-24T09:24:04.9363318Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): error C2678: binary '-': no operator found which takes a left-hand operand of type '_InIt' (or there is no acceptable conversion)
2025-12-24T09:24:04.9363870Z         with
2025-12-24T09:24:04.9363999Z         [
2025-12-24T09:24:04.9364216Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9364445Z         ]
2025-12-24T09:24:04.9365256Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/iterator.h(145): note: could be 'DerivedT llvm::iterator_facade_base<DerivedT,IteratorCategoryT,T,DifferenceTypeT,PointerT,ReferenceT>::operator -(DifferenceTypeT) const'
2025-12-24T09:24:04.9365909Z         with
2025-12-24T09:24:04.9366031Z         [
2025-12-24T09:24:04.9366358Z             DerivedT=llvm::mapped_iterator<mlir::ArrayAttr::iterator,mlir::DictionaryAttr (__cdecl *)(mlir::Attribute),mlir::DictionaryAttr>,
2025-12-24T09:24:04.9366879Z             IteratorCategoryT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::iterator_category,
2025-12-24T09:24:04.9367718Z             T=mlir::DictionaryAttr,
2025-12-24T09:24:04.9368031Z             DifferenceTypeT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::difference_type,
2025-12-24T09:24:04.9368357Z             PointerT=mlir::DictionaryAttr *,
2025-12-24T09:24:04.9368546Z             ReferenceT=mlir::DictionaryAttr
2025-12-24T09:24:04.9368716Z         ]
2025-12-24T09:24:04.9369473Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'DerivedT llvm::iterator_facade_base<DerivedT,IteratorCategoryT,T,DifferenceTypeT,PointerT,ReferenceT>::operator -(DifferenceTypeT) const': cannot convert argument 2 from '_InIt' to 'DifferenceTypeT'
2025-12-24T09:24:04.9370312Z         with
2025-12-24T09:24:04.9370434Z         [
2025-12-24T09:24:04.9370759Z             DerivedT=llvm::mapped_iterator<mlir::ArrayAttr::iterator,mlir::DictionaryAttr (__cdecl *)(mlir::Attribute),mlir::DictionaryAttr>,
2025-12-24T09:24:04.9371280Z             IteratorCategoryT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::iterator_category,
2025-12-24T09:24:04.9371598Z             T=mlir::DictionaryAttr,
2025-12-24T09:24:04.9371913Z             DifferenceTypeT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::difference_type,
2025-12-24T09:24:04.9372233Z             PointerT=mlir::DictionaryAttr *,
2025-12-24T09:24:04.9372425Z             ReferenceT=mlir::DictionaryAttr
2025-12-24T09:24:04.9372600Z         ]
2025-12-24T09:24:04.9372713Z         and
2025-12-24T09:24:04.9372827Z         [
2025-12-24T09:24:04.9373000Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9373218Z         ]
2025-12-24T09:24:04.9373329Z         and
2025-12-24T09:24:04.9373431Z         [
2025-12-24T09:24:04.9373682Z             DifferenceTypeT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::difference_type
2025-12-24T09:24:04.9373968Z         ]
2025-12-24T09:24:04.9374485Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2025-12-24T09:24:04.9375390Z C:\home\runner\_work\iree\iree\third_party\llvm-project\mlir\include\mlir/IR/AffineExpr.h(253): note: or       'mlir::AffineExpr mlir::operator -(int64_t,mlir::AffineExpr)' [found using argument-dependent lookup]
2025-12-24T09:24:04.9376274Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'mlir::AffineExpr mlir::operator -(int64_t,mlir::AffineExpr)': cannot convert argument 1 from '_InIt' to 'int64_t'
2025-12-24T09:24:04.9376805Z         with
2025-12-24T09:24:04.9376916Z         [
2025-12-24T09:24:04.9377096Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9377310Z         ]
2025-12-24T09:24:04.9377819Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2025-12-24T09:24:04.9378699Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/APInt.h(2214): note: or       'llvm::APInt llvm::operator -(llvm::APInt,const llvm::APInt &)' [found using argument-dependent lookup]
2025-12-24T09:24:04.9379683Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'llvm::APInt llvm::operator -(llvm::APInt,const llvm::APInt &)': cannot convert argument 1 from '_InIt' to 'llvm::APInt'
2025-12-24T09:24:04.9380231Z         with
2025-12-24T09:24:04.9380350Z         [
2025-12-24T09:24:04.9380526Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9380749Z         ]
2025-12-24T09:24:04.9381304Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2025-12-24T09:24:04.9382196Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/APInt.h(2219): note: or       'llvm::APInt llvm::operator -(const llvm::APInt &,llvm::APInt &&)' [found using argument-dependent lookup]
2025-12-24T09:24:04.9383081Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'llvm::APInt llvm::operator -(const llvm::APInt &,llvm::APInt &&)': cannot convert argument 1 from '_InIt' to 'const llvm::APInt &'
2025-12-24T09:24:04.9383669Z         with
2025-12-24T09:24:04.9383787Z         [
2025-12-24T09:24:04.9383956Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9384175Z         ]
2025-12-24T09:24:04.9384561Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: Reason: cannot convert from '_InIt' to 'const llvm::APInt'
2025-12-24T09:24:04.9384972Z         with
2025-12-24T09:24:04.9385087Z         [
2025-12-24T09:24:04.9385247Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9385463Z         ]
2025-12-24T09:24:04.9385957Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2025-12-24T09:24:04.9386822Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/APInt.h(2225): note: or       'llvm::APInt llvm::operator -(llvm::APInt,uint64_t)' [found using argument-dependent lookup]
2025-12-24T09:24:04.9387650Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'llvm::APInt llvm::operator -(llvm::APInt,uint64_t)': cannot convert argument 1 from '_InIt' to 'llvm::APInt'
2025-12-24T09:24:04.9388153Z         with
2025-12-24T09:24:04.9388267Z         [
2025-12-24T09:24:04.9388439Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9388645Z         ]
2025-12-24T09:24:04.9389145Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2025-12-24T09:24:04.9390002Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/APInt.h(2230): note: or       'llvm::APInt llvm::operator -(uint64_t,llvm::APInt)' [found using argument-dependent lookup]
2025-12-24T09:24:04.9390819Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'llvm::APInt llvm::operator -(uint64_t,llvm::APInt)': cannot convert argument 1 from '_InIt' to 'uint64_t'
2025-12-24T09:24:04.9391321Z         with
2025-12-24T09:24:04.9391426Z         [
2025-12-24T09:24:04.9391598Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9391807Z         ]
2025-12-24T09:24:04.9392304Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2025-12-24T09:24:04.9393326Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/DynamicAPInt.h(555): note: or       'llvm::DynamicAPInt llvm::operator -(const llvm::DynamicAPInt &,int64_t)' [found using argument-dependent lookup]
2025-12-24T09:24:04.9394317Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'llvm::DynamicAPInt llvm::operator -(const llvm::DynamicAPInt &,int64_t)': cannot convert argument 1 from '_InIt' to 'const llvm::DynamicAPInt &'
2025-12-24T09:24:04.9394966Z         with
2025-12-24T09:24:04.9395084Z         [
2025-12-24T09:24:04.9395253Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9395474Z         ]
2025-12-24T09:24:04.9395866Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: Reason: cannot convert from '_InIt' to 'const llvm::DynamicAPInt'
2025-12-24T09:24:04.9396298Z         with
2025-12-24T09:24:04.9396404Z         [
2025-12-24T09:24:04.9396579Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9396838Z         ]
2025-12-24T09:24:04.9397338Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2025-12-24T09:24:04.9398269Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/DynamicAPInt.h(575): note: or       'llvm::DynamicAPInt llvm::operator -(int64_t,const llvm::DynamicAPInt &)' [found using argument-dependent lookup]
2025-12-24T09:24:04.9399213Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'llvm::DynamicAPInt llvm::operator -(int64_t,const llvm::DynamicAPInt &)': cannot convert argument 1 from '_InIt' to 'int64_t'
2025-12-24T09:24:04.9399758Z         with
2025-12-24T09:24:04.9399876Z         [
2025-12-24T09:24:04.9400051Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9400275Z         ]
2025-12-24T09:24:04.9400771Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2025-12-24T09:24:04.9402211Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/iterator.h(272): note: or       '__int64 llvm::iterator_adaptor_base<llvm::mapped_iterator<mlir::ArrayAttr::iterator,AttrTy (__cdecl *)(mlir::Attribute),AttrTy>,ItTy,std::_Iterator_traits_pointer_base<_Ty,true>::iterator_category,mlir::DictionaryAttr,std::_Iterator_traits_pointer_base<_Ty,true>::difference_type,mlir::DictionaryAttr *,ReferenceTy>::operator -(const DerivedT &) const'
2025-12-24T09:24:04.9403228Z         with
2025-12-24T09:24:04.9403335Z         [
2025-12-24T09:24:04.9403468Z             AttrTy=mlir::DictionaryAttr,
2025-12-24T09:24:04.9403660Z             ItTy=mlir::ArrayAttr::iterator,
2025-12-24T09:24:04.9403841Z             _Ty=const mlir::Attribute,
2025-12-24T09:24:04.9404032Z             ReferenceTy=mlir::DictionaryAttr,
2025-12-24T09:24:04.9404407Z             DerivedT=llvm::mapped_iterator<mlir::ArrayAttr::iterator,mlir::DictionaryAttr (__cdecl *)(mlir::Attribute),mlir::DictionaryAttr>
2025-12-24T09:24:04.9404768Z         ]
2025-12-24T09:24:04.9405874Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: '__int64 llvm::iterator_adaptor_base<llvm::mapped_iterator<mlir::ArrayAttr::iterator,AttrTy (__cdecl *)(mlir::Attribute),AttrTy>,ItTy,std::_Iterator_traits_pointer_base<_Ty,true>::iterator_category,mlir::DictionaryAttr,std::_Iterator_traits_pointer_base<_Ty,true>::difference_type,mlir::DictionaryAttr *,ReferenceTy>::operator -(const DerivedT &) const': could not deduce template argument for 'Enabled'
2025-12-24T09:24:04.9407012Z         with
2025-12-24T09:24:04.9407176Z         [
2025-12-24T09:24:04.9407343Z             AttrTy=mlir::DictionaryAttr,
2025-12-24T09:24:04.9407541Z             ItTy=mlir::ArrayAttr::iterator,
2025-12-24T09:24:04.9407729Z             _Ty=const mlir::Attribute,
2025-12-24T09:24:04.9407911Z             ReferenceTy=mlir::DictionaryAttr,
2025-12-24T09:24:04.9408296Z             DerivedT=llvm::mapped_iterator<mlir::ArrayAttr::iterator,mlir::DictionaryAttr (__cdecl *)(mlir::Attribute),mlir::DictionaryAttr>
2025-12-24T09:24:04.9408702Z         ]
2025-12-24T09:24:04.9409613Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/iterator.h(270): note: 'llvm::iterator_facade_base<DerivedT,IteratorCategoryT,T,DifferenceTypeT,PointerT,ReferenceT>::IsRandomAccess': cannot access protected enumerator declared in class 'llvm::iterator_facade_base<DerivedT,IteratorCategoryT,T,DifferenceTypeT,PointerT,ReferenceT>'
2025-12-24T09:24:04.9410551Z         with
2025-12-24T09:24:04.9410664Z         [
2025-12-24T09:24:04.9410993Z             DerivedT=llvm::mapped_iterator<mlir::ArrayAttr::iterator,mlir::DictionaryAttr (__cdecl *)(mlir::Attribute),mlir::DictionaryAttr>,
2025-12-24T09:24:04.9411553Z             IteratorCategoryT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::iterator_category,
2025-12-24T09:24:04.9411880Z             T=mlir::DictionaryAttr,
2025-12-24T09:24:04.9412192Z             DifferenceTypeT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::difference_type,
2025-12-24T09:24:04.9412507Z             PointerT=mlir::DictionaryAttr *,
2025-12-24T09:24:04.9412702Z             ReferenceT=mlir::DictionaryAttr
2025-12-24T09:24:04.9412862Z         ]
2025-12-24T09:24:04.9413422Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/iterator.h(90): note: see declaration of 'llvm::iterator_facade_base<DerivedT,IteratorCategoryT,T,DifferenceTypeT,PointerT,ReferenceT>::IsRandomAccess'
2025-12-24T09:24:04.9414017Z         with
2025-12-24T09:24:04.9414124Z         [
2025-12-24T09:24:04.9414448Z             DerivedT=llvm::mapped_iterator<mlir::ArrayAttr::iterator,mlir::DictionaryAttr (__cdecl *)(mlir::Attribute),mlir::DictionaryAttr>,
2025-12-24T09:24:04.9414956Z             IteratorCategoryT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::iterator_category,
2025-12-24T09:24:04.9415276Z             T=mlir::DictionaryAttr,
2025-12-24T09:24:04.9415580Z             DifferenceTypeT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::difference_type,
2025-12-24T09:24:04.9415885Z             PointerT=mlir::DictionaryAttr *,
2025-12-24T09:24:04.9416082Z             ReferenceT=mlir::DictionaryAttr
2025-12-24T09:24:04.9416250Z         ]
2025-12-24T09:24:04.9416889Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/iterator.h(80): note: see declaration of 'llvm::iterator_facade_base<DerivedT,IteratorCategoryT,T,DifferenceTypeT,PointerT,ReferenceT>'
2025-12-24T09:24:04.9417444Z         with
2025-12-24T09:24:04.9417550Z         [
2025-12-24T09:24:04.9417873Z             DerivedT=llvm::mapped_iterator<mlir::ArrayAttr::iterator,mlir::DictionaryAttr (__cdecl *)(mlir::Attribute),mlir::DictionaryAttr>,
2025-12-24T09:24:04.9418386Z             IteratorCategoryT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::iterator_category,
2025-12-24T09:24:04.9418699Z             T=mlir::DictionaryAttr,
2025-12-24T09:24:04.9418999Z             DifferenceTypeT=std::_Iterator_traits_pointer_base<const mlir::Attribute,true>::difference_type,
2025-12-24T09:24:04.9419309Z             PointerT=mlir::DictionaryAttr *,
2025-12-24T09:24:04.9419496Z             ReferenceT=mlir::DictionaryAttr
2025-12-24T09:24:04.9419663Z         ]
2025-12-24T09:24:04.9420091Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\complex(1523): note: or       'std::complex<_Ty> std::operator -(const std::complex<_Ty> &) noexcept(<expr>)'
2025-12-24T09:24:04.9420974Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\complex(1461): note: or       'std::complex<_Ty> std::operator -(const _Ty &,const std::complex<_Ty> &) noexcept(<expr>)'
2025-12-24T09:24:04.9421922Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'std::complex<_Ty> std::operator -(const _Ty &,const std::complex<_Ty> &) noexcept(<expr>)': could not deduce template argument for 'const std::complex<_Ty> &' from '_InIt'
2025-12-24T09:24:04.9422598Z         with
2025-12-24T09:24:04.9422712Z         [
2025-12-24T09:24:04.9422887Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9423112Z         ]
2025-12-24T09:24:04.9423698Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\complex(1453): note: or       'std::complex<_Ty> std::operator -(const std::complex<_Ty> &,const _Ty &) noexcept(<expr>)'
2025-12-24T09:24:04.9424717Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'std::complex<_Ty> std::operator -(const std::complex<_Ty> &,const _Ty &) noexcept(<expr>)': could not deduce template argument for 'const std::complex<_Ty> &' from '_InIt'
2025-12-24T09:24:04.9425479Z         with
2025-12-24T09:24:04.9425587Z         [
2025-12-24T09:24:04.9425768Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9425982Z         ]
2025-12-24T09:24:04.9426442Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\complex(1445): note: or       'std::complex<_Ty> std::operator -(const std::complex<_Ty> &,const std::complex<_Ty> &) noexcept(<expr>)'
2025-12-24T09:24:04.9427466Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'std::complex<_Ty> std::operator -(const std::complex<_Ty> &,const std::complex<_Ty> &) noexcept(<expr>)': could not deduce template argument for 'const std::complex<_Ty> &' from '_InIt'
2025-12-24T09:24:04.9428094Z         with
2025-12-24T09:24:04.9428210Z         [
2025-12-24T09:24:04.9428388Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9428599Z         ]
2025-12-24T09:24:04.9429099Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(4528): note: or       'unknown-type std::operator -(const std::move_iterator<_Iter> &,const std::move_iterator<_Iter2> &) noexcept(<expr>)'
2025-12-24T09:24:04.9430177Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'unknown-type std::operator -(const std::move_iterator<_Iter> &,const std::move_iterator<_Iter2> &) noexcept(<expr>)': could not deduce template argument for 'const std::move_iterator<_Iter> &' from '_InIt'
2025-12-24T09:24:04.9430867Z         with
2025-12-24T09:24:04.9430984Z         [
2025-12-24T09:24:04.9431154Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9431371Z         ]
2025-12-24T09:24:04.9431880Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1977): note: or       'unknown-type std::operator -(const std::reverse_iterator<_BidIt> &,const std::reverse_iterator<_BidIt2> &) noexcept(<expr>)'
2025-12-24T09:24:04.9433002Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: 'unknown-type std::operator -(const std::reverse_iterator<_BidIt> &,const std::reverse_iterator<_BidIt2> &) noexcept(<expr>)': could not deduce template argument for 'const std::reverse_iterator<_BidIt> &' from '_InIt'
2025-12-24T09:24:04.9433723Z         with
2025-12-24T09:24:04.9433829Z         [
2025-12-24T09:24:04.9434000Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9434204Z         ]
2025-12-24T09:24:04.9435023Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: while trying to match the argument list '(_InIt, _InIt)'
2025-12-24T09:24:04.9435453Z         with
2025-12-24T09:24:04.9435562Z         [
2025-12-24T09:24:04.9435738Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9435945Z         ]
2025-12-24T09:24:04.9436330Z C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(1662): note: the template instantiation context (the oldest one first) is
2025-12-24T09:24:04.9437314Z B:\tmpbuild\llvm-project\tools\mlir\include\mlir/Interfaces/FunctionInterfaces.h.inc(418): note: see reference to function template instantiation 'void llvm::SmallVectorImpl<mlir::DictionaryAttr>::append<IteratorT,void>(ItTy,ItTy)' being compiled
2025-12-24T09:24:04.9437950Z         with
2025-12-24T09:24:04.9438064Z         [
2025-12-24T09:24:04.9438253Z             IteratorT=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>,
2025-12-24T09:24:04.9438556Z             ItTy=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:04.9438817Z         ]
2025-12-24T09:24:04.9439357Z B:\tmpbuild\llvm-project\tools\mlir\include\mlir/Interfaces/FunctionInterfaces.h.inc(418): note: see the first reference to 'llvm::SmallVectorImpl<mlir::DictionaryAttr>::append' in 'mlir::FunctionOpInterface::getAllArgAttrs'
2025-12-24T09:24:05.1508899Z C:\home\runner\_work\iree\iree\third_party\llvm-project\llvm\include\llvm/ADT/SmallVector.h(686): note: see reference to function template instantiation '__int64 std::distance<ItTy>(_InIt,_InIt)' being compiled
2025-12-24T09:24:05.1509481Z         with
2025-12-24T09:24:05.1509606Z         [
2025-12-24T09:24:05.1509808Z             ItTy=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>,
2025-12-24T09:24:05.1510094Z             _InIt=mlir::ArrayAttr::attr_value_iterator<mlir::DictionaryAttr>
2025-12-24T09:24:05.1510311Z         ]
2025-12-24T09:24:05.1510811Z [9007/9574] Building CXX object

@vedranmiletic
Copy link
Contributor

@jtuyls @kuhar FWIW, I am wondering if some friend markings would be a less radical option that would satisfy MSVC.

That also works, but we need the forward declaration of iterator_adaptor_base and then add it as a friend of iterator_facade_base, which is a bit weird imo because it makes a derived class friend of a parent. And I don't see an issue with making IsRandomAccess and IsBidirectional public as they are just compile-time constants that won't change. So, making them public is the simplest and clearest solution for this issue imo. WDYT?

It is a bit weird, but OTOH making them public is an API promise, which might be harder to change in the future. I would say the comment explains the weirdness of MSVC and would actually lean towards that solution.

@kuhar
Copy link
Member

kuhar commented Dec 26, 2025

ADT is not considered stable API

@vedranmiletic
Copy link
Contributor

Right, then making the symbols public is fine and definitely simpler. Sorry, I don't have GitHub access to formally approve.

@jtuyls
Copy link
Contributor Author

jtuyls commented Dec 26, 2025

If ok, could someone help merge this? @kuhar @vedranmiletic

@kuhar kuhar merged commit 75a0347 into llvm:main Dec 29, 2025
10 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 29, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-mlir-rhel-clang running on ppc64le-mlir-rhel-test while building llvm at step 6 "test-build-check-mlir-build-only-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/129/builds/35595

Here is the relevant piece of the build log for the reference
Step 6 (test-build-check-mlir-build-only-check-mlir) failure: 1200 seconds without output running [b'ninja', b'check-mlir'], attempting to kill
...
PASS: MLIR-Unit :: Interfaces/./MLIRInterfacesTests/12/22 (3777 of 3788)
PASS: MLIR-Unit :: Interfaces/./MLIRInterfacesTests/11/22 (3778 of 3788)
PASS: MLIR :: Transforms/location-snapshot.mlir (3779 of 3788)
PASS: MLIR :: Pass/action-logging-filter.mlir (3780 of 3788)
PASS: MLIR :: mlir-tblgen/cpp-class-comments.td (3781 of 3788)
PASS: MLIR :: mlir-runner/utils.mlir (3782 of 3788)
PASS: MLIR :: mlir-runner/simple.mlir (3783 of 3788)
PASS: MLIR :: mlir-reduce/dce-test.mlir (3784 of 3788)
PASS: MLIR :: Pass/pipeline-parsing.mlir (3785 of 3788)
PASS: MLIR-Unit :: IR/./MLIRIRTests/0/131 (3786 of 3788)
command timed out: 1200 seconds without output running [b'ninja', b'check-mlir'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=2026.946064

jtuyls added a commit to iree-org/iree that referenced this pull request Dec 29, 2025
Integrate
llvm/llvm-project@75a0347

Removes a revert:
* Local revert of llvm/llvm-project#169772 as
the fix in llvm/llvm-project#173495 got merged.

Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due
to llvm/llvm-project#172932.

Signed-off-by: Jorn Tuyls <[email protected]>
keshavvinayak01 pushed a commit to iree-org/iree that referenced this pull request Jan 27, 2026
Integrate
llvm/llvm-project@c0f4a8a

Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due
to llvm/llvm-project#172932.

Also adds a revert for a commit that breaks the MSVC build:
* Local revert of llvm/llvm-project#169772. This
can be dropped after llvm/llvm-project#173495.

Signed-off-by: Jorn Tuyls <[email protected]>
Signed-off-by: Keshav Vinayak Jha <[email protected]>
keshavvinayak01 pushed a commit to iree-org/iree that referenced this pull request Jan 27, 2026
Integrate
llvm/llvm-project@75a0347

Removes a revert:
* Local revert of llvm/llvm-project#169772 as
the fix in llvm/llvm-project#173495 got merged.

Existing local reverts carried forward:
* Local revert of llvm/llvm-project#169614 due
to llvm/llvm-project#172932.

Signed-off-by: Jorn Tuyls <[email protected]>
Signed-off-by: Keshav Vinayak Jha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants