diff --git a/llvm/include/llvm/ADT/iterator.h b/llvm/include/llvm/ADT/iterator.h index c0495e24893fb..5d129ea9f10df 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::value, @@ -93,6 +95,7 @@ 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