[cfe-users] clang compilation errors in MCModule.cpp

Manuel Portilheiro manuel.portilheiro at gmail.com
Thu Jun 27 02:00:15 PDT 2013


Hi,



I’ve just downloaded llvm/clang and tried to compile it, but I’m getting
errors and I don’t know how to proceed.



I’ve googled for this type of error but could not find anything relevant.



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:



MCModule.cpp

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'

        There is no context in which this conversion is possible

        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

        with

        [

            _Ty=uint64_t,

            _Pr=bool (__cdecl *)(const llvm::MCAtom *,uint64_t),

            _Ty1=llvm::MCAtom *,

            _Ty2=uint64_t

        ]

        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

        with

        [

            _FwdIt=std::_Vector_iterator<llvm::MCAtom
*,std::allocator<llvm::MCAtom *>>,

            _Ty=llvm::MCAtom *,

            _Alloc=std::allocator<llvm::MCAtom *>,

            _Pr=bool (__cdecl *)(const llvm::MCAtom *,uint64_t),

            _Diff=__w64 int

        ]

        ..\..\..\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

        with

        [

            _FwdIt=llvm::MCModule::atom_iterator,

            _Ty=uint64_t,

            _Pr=bool (__cdecl *)(const llvm::MCAtom *,uint64_t)

        ]



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),
_Debug_lt_pred
where the predicate _Pred is static bool AtomComp(const MCAtom *L, uint64_t
Addr) (in MCModule.cpp:17), _Left is* the iterator between atom_begin() and
atom*_end(), and _*Right is* uint64_t Begin = NewAtom->Begin;



At this point the predicate is applied to the arguments in the reverse
order (right, left), and the types are not compatible (cannot convert
parameter 2 from 'llvm::MCAtom *' to 'uint64_t'), because the predicate
dereferences the first argument(!).



Am I seeing this right? Do I have a bugged/old/incompatible version of
xutility?



Please, help!



Thanks in advance,

Manuel Portilheiro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20130627/a8eb0316/attachment.html>


More information about the cfe-users mailing list