<div dir="ltr">

<p class=""><span style lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">Hi,</span></p>

<p class=""><span style lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">I’ve just
downloaded llvm/clang and tried to compile it, but I’m getting errors and I don’t
know how to proceed.</span></p>

<p class=""><span style lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">I’ve
googled for this type of error but could not find anything relevant.</span></p>

<p class=""><span style lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">I’m working
with Windows/Visual Studio 2008. I was able to generate the solution files and
tried to compile all projects with the ALL_BUILD project. The error I’m getting
occurs in different points of the code, and with different classes, but it
boils down to this one example:</span></p>

<p class=""><span style lang="EN-US"> </span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US">MCModule.cpp</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US">C:\Program Files\Microsoft Visual Studio
9.0\VC\include\xutility(337) : error C2664: 'bool (const llvm::MCAtom
*,uint64_t)' : cannot convert parameter 2 from 'llvm::MCAtom *' to 'uint64_t'</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span>There is
no context in which this conversion is possible</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>       
</span>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(2298)
: see reference to function template instantiation 'bool
std::_Debug_lt_pred<bool(__cdecl *)(const llvm::MCAtom
*,uint64_t),llvm::MCAtom*,_Ty>(_Pr,_Ty1 &,const _Ty2 &,const wchar_t
*,unsigned int)' being compiled</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span>with</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span>[</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           </span><span style> </span>_Ty=uint64_t,</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_Pr=bool (__cdecl *)(const llvm::MCAtom *,uint64_t),</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_Ty1=llvm::MCAtom *,</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_Ty2=uint64_t</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span>]</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>       
</span>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(2312)
: see reference to function template instantiation '_FwdIt
std::_Lower_bound<std::_Vector_iterator<_Ty,_Alloc>,unsigned
__int64,__w64 int,bool(__cdecl *)(const llvm::MCAtom
*,uint64_t)>(_FwdIt,_FwdIt,const unsigned __int64 &,_Pr,_Diff *)' being
compiled</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span>with</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span>[</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_FwdIt=std::_Vector_iterator<llvm::MCAtom
*,std::allocator<llvm::MCAtom *>>,</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_Ty=llvm::MCAtom *,</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_Alloc=std::allocator<llvm::MCAtom *>,</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_Pr=bool (__cdecl *)(const llvm::MCAtom *,uint64_t),</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_Diff=__w64 int</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span>]</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>       
</span>..\..\..\llvm\lib\MC\MCModule.cpp(28) : see reference to function
template instantiation '_FwdIt
std::lower_bound<llvm::MCModule::atom_iterator,uint64_t,bool(__cdecl
*)(const llvm::MCAtom *,uint64_t)>(_FwdIt,_FwdIt,const _Ty &,_Pr)' being
compiled</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span>with</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span>[</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_FwdIt=llvm::MCModule::atom_iterator,</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_Ty=uint64_t,</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>           
</span>_Pr=bool (__cdecl *)(const llvm::MCAtom *,uint64_t)</span></p>

<p class="" style="text-autospace:none"><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US"><span style>        </span></span><span style="font-size:8pt;font-family:"Courier New"">]</span></p>


<p class=""><span style lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">I’ve
followed the call thread from MCModule.cpp and it ends up in my VS’s xutility,
line 337 (which of course is what the error message says), </span><span style="font-size:10pt;font-family:"Courier New"" lang="EN-US">_Debug_lt_pred where the predicate _Pred is <span style="color:blue">static</span> <span style="color:blue">bool</span> AtomComp(<span style="color:blue">const</span> MCAtom *L, uint64_t Addr) (in MCModule.cpp:17),
_Left is<i> the iterator between atom_begin() and atom</i>_end(), and _<i>Right
is</i> uint64_t Begin = NewAtom->Begin;</span></p>

<p class=""><span style="font-size:10pt;font-family:"Courier New"" lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">At this
point the predicate is applied to the arguments in the reverse order (right,
left), and the types are not compatible (</span><span style="font-size:8pt;font-family:"Courier New"" lang="EN-US">cannot convert parameter 2 from 'llvm::MCAtom *' to
'uint64_t'</span><span style lang="EN-US">), because
the predicate dereferences the first argument(!).</span></p>

<p class=""><span style lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">Am I seeing
this right? Do I have a bugged/old/incompatible version of xutility?</span></p>

<p class=""><span style lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">Please,
help!</span></p>

<p class=""><span style lang="EN-US"> </span></p>

<p class=""><span style lang="EN-US">Thanks in
advance,</span></p>

<p class=""><span style lang="EN-US">Manuel
Portilheiro</span></p>

<p class=""><span style lang="EN-US"> </span></p>

</div>