clang build failures using Visual Studio

Anyone run into this before?
I’m trying to get a Windows native build using Visual Studio of LLVM, Clang, and LLD 4.0.0. So far LLVM built successfully, but I’m getting these cryptic error messages when building Clang:

Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.

ClangDiagnosticsEmitter.cpp
c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\14.10.25017\include\xmemory(126): error C2678: binary ‘*’: no operator found which takes a left-hand operand of type ‘const llvm::detail::DenseSetImpl<ValueT,llvm::DenseMap<ValueT,llvm::detail::DenseSetEmpty,ValueInfoT,llvm::detail::DenseSetPair>,ValueInfoT>::Iterator’ (or there is no acceptable conversion)
with
[
ValueT=const llvm::Record *,
ValueInfoT=llvm::DenseMapInfo<const llvm::Record *>
]
C:\deps\llvm-4.0.0\include\llvm/ADT/DenseSet.h(106): note: could be ‘const llvm::Record *&llvm::detail::DenseSetImpl<ValueT,llvm::DenseMap<ValueT,llvm::detail::DenseSetEmpty,ValueInfoT,llvm::detail::DenseSetPair>,ValueInfoT>::Iterator::operator *(void)’
with
[
ValueT=const llvm::Record *,
ValueInfoT=llvm::DenseMapInfo<const llvm::Record *>
]
c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\14.10.25017\include\xmemory(126): note: while trying to match the argument list ‘(const llvm::detail::DenseSetImpl<ValueT,llvm::DenseMap<ValueT,llvm::detail::DenseSetEmpty,ValueInfoT,llvm::detail::DenseSetPair>,ValueInfoT>::Iterator)’
with
[
ValueT=const llvm::Record *,
ValueInfoT=llvm::DenseMapInfo<const llvm::Record *>
]
c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\14.10.25017\include\vector(1859): note: see reference to function template instantiation ‘_FwdIt std::_Uninitialized_copy<_Iter,const llvm::Record,std::allocator<_Ty>>(_InIt,_InIt,_FwdIt,std::_Wrap_alloc<std::allocator<_Ty>> &)’ being compiled
with
[
_FwdIt=const llvm::Record **,
_Iter=llvm::detail::DenseSetImpl<const llvm::Record *,llvm::DenseMap<const llvm::Record *,llvm::detail::DenseSetEmpty,llvm::DenseMapInfo<const llvm::Record *>,llvm::detail::DenseSetPair<const llvm::Record *>>,llvm::DenseMapInfo<const llvm::Record *>>::Iterator,
_Ty=const llvm::Record *,
_InIt=llvm::detail::DenseSetImpl<const llvm::Record *,llvm::DenseMap<const llvm::Record *,llvm::detail::DenseSetEmpty,llvm::DenseMapInfo<const llvm::Record *>,llvm::detail::DenseSetPair<const llvm::Record *>>,llvm::DenseMapInfo<const llvm::Record *>>::Iterator
]
c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\14.10.25017\include\vector(779): note: see reference to function template instantiation ‘const llvm::Record **std::vector<const llvm::Record *,std::allocator<_Ty>>::_Ucopy<_Iter>(_Iter,_Iter,const llvm::Record **)’ being compiled
with
[
_Ty=const llvm::Record *,
_Iter=llvm::detail::DenseSetImpl<const llvm::Record *,llvm::DenseMap<const llvm::Record *,llvm::detail::DenseSetEmpty,llvm::DenseMapInfo<const llvm::Record *>,llvm::detail::DenseSetPair<const llvm::Record *>>,llvm::DenseMapInfo<const llvm::Record *>>::Iterator
]
c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\14.10.25017\include\vector(779): note: see reference to function template instantiation ‘const llvm::Record **std::vector<const llvm::Record *,std::allocator<_Ty>>::_Ucopy<_Iter>(_Iter,_Iter,const llvm::Record **)’ being compiled
with
[
_Ty=const llvm::Record *,
_Iter=llvm::detail::DenseSetImpl<const llvm::Record *,llvm::DenseMap<const llvm::Record *,llvm::detail::DenseSetEmpty,llvm::DenseMapInfo<const llvm::Record *>,llvm::detail::DenseSetPair<const llvm::Record *>>,llvm::DenseMapInfo<const llvm::Record *>>::Iterator
]
c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\14.10.25017\include\vector(794): note: see reference to function template instantiation ‘void std::vector<const llvm::Record *,std::allocator<_Ty>>::_Range_construct_or_tidy<_Iter>(_Iter,_Iter,std::forward_iterator_tag)’ being compiled
with
[
_Ty=const llvm::Record *,
_Iter=llvm::detail::DenseSetImpl<const llvm::Record *,llvm::DenseMap<const llvm::Record *,llvm::detail::DenseSetEmpty,llvm::DenseMapInfo<const llvm::Record *>,llvm::detail::DenseSetPair<const llvm::Record *>>,llvm::DenseMapInfo<const llvm::Record *>>::Iterator
]
c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\14.10.25017\include\vector(794): note: see reference to function template instantiation ‘void std::vector<const llvm::Record *,std::allocator<_Ty>>::_Range_construct_or_tidy<_Iter>(_Iter,_Iter,std::forward_iterator_tag)’ being compiled
with
[
_Ty=const llvm::Record *,
_Iter=llvm::detail::DenseSetImpl<const llvm::Record *,llvm::DenseMap<const llvm::Record *,llvm::detail::DenseSetEmpty,llvm::DenseMapInfo<const llvm::Record *>,llvm::detail::DenseSetPair<const llvm::Record *>>,llvm::DenseMapInfo<const llvm::Record *>>::Iterator
]
C:\Users\andy\Downloads\cfe-4.0.0.src\utils\TableGen\ClangDiagnosticsEmitter.cpp(1257): note: see reference to function template instantiation ‘std::vector<const llvm::Record *,std::allocator<_Ty>>::vector<llvm::detail::DenseSetImpl<ValueT,llvm::DenseMap<ValueT,llvm::detail::DenseSetEmpty,ValueInfoT,llvm::detail::DenseSetPair>,ValueInfoT>::Iterator,void>(_Iter,_Iter,const std::allocator<_Ty> &)’ being compiled
with
[
_Ty=const llvm::Record *,
ValueT=const llvm::Record *,
ValueInfoT=llvm::DenseMapInfo<const llvm::Record *>,
_Iter=llvm::detail::DenseSetImpl<const llvm::Record *,llvm::DenseMap<const llvm::Record *,llvm::detail::DenseSetEmpty,llvm::DenseMapInfo<const llvm::Record *>,llvm::detail::DenseSetPair<const llvm::Record *>>,llvm::DenseMapInfo<const llvm::Record *>>::Iterator
]
C:\Users\andy\Downloads\cfe-4.0.0.src\utils\TableGen\ClangDiagnosticsEmitter.cpp(1256): note: see reference to function template instantiation ‘std::vector<const llvm::Record *,std::allocator<_Ty>>::vector<llvm::detail::DenseSetImpl<ValueT,llvm::DenseMap<ValueT,llvm::detail::DenseSetEmpty,ValueInfoT,llvm::detail::DenseSetPair>,ValueInfoT>::Iterator,void>(_Iter,_Iter,const std::allocator<_Ty> &)’ being compiled
with
[
_Ty=const llvm::Record *,
ValueT=const llvm::Record *,
ValueInfoT=llvm::DenseMapInfo<const llvm::Record *>,
_Iter=llvm::detail::DenseSetImpl<const llvm::Record *,llvm::DenseMap<const llvm::Record *,llvm::detail::DenseSetEmpty,llvm::DenseMapInfo<const llvm::Record *>,llvm::detail::DenseSetPair<const llvm::Record *>>,llvm::DenseMapInfo<const llvm::Record *>>::Iterator
]
c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\14.10.25017\include\xmemory(126): error C2100: illegal indirection
c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\14.10.25017\include\xmemory(126): error C2062: type ‘unknown-type’ unexpected
gtest.vcxproj → C:\Users\andy\AppData\Local\CMakeBuild\12c242dd-f206-c033-afac-74b8717657f2\build\x86-Debug\Debug\lib\gtest.lib
gtest_main.vcxproj → C:\Users\andy\AppData\Local\CMakeBuild\12c242dd-f206-c033-afac-74b8717657f2\build\x86-Debug\Debug\lib\gtest_main.lib
Generating …/…/bin/scan-build.bat
Generating …/…/libexec/ccc-analyzer.bat
Generating …/…/libexec/c+±analyzer.bat
Generating …/…/share/man/man1/scan-build.1
Generating …/…/share/scan-build/scanview.css
Generating …/…/share/scan-build/sorttable.js
Generating …/…/bin/scan-view
Generating …/…/share/scan-view/ScanView.py
Generating …/…/share/scan-view/Reporter.py
Generating …/…/share/scan-view/startfile.py
Generating …/…/share/scan-view/FileRadar.scpt
Generating …/…/share/scan-view/GetRadarVersion.scpt
Generating …/…/share/scan-view/bugcatcher.ico

Build failed.

We discussed this on IRC. As far as I know, Visual Studio 2017 isn’t fully supported yet (it’s being worked on), but VS 2015 should work.

Thanks. For the record, LLVM and LLD 4.0.0 build fine with Visual Studio 2017 already.

Is this likely something that will be fixed in 4.0.1, or is this a 5.0.0 issue?