MantisBT - VCMI
View Issue Details
0000766VCMIOtherpublic2011-07-05 18:052011-09-02 00:33
dimqua 
ubuntux 
normalblockalways
closedwon't fix 
DebianGNU/Linux
 
 
0000766: Clang -- compilation fails
Compilation fails with the following message:

dimqua@localhost:~/vcmi$ make
Making all in lib
make[1]: Entering directory `/home/dimqua/vcmi/lib'
  CXX libvcmi_la-BattleAction.lo
  CXX libvcmi_la-BattleState.lo
  CXX libvcmi_la-CArtHandler.lo
In file included from CArtHandler.cpp:2:
In file included from ./../stdafx.h:21:
./../global.h:417:10: error: use of undeclared identifier 'find'
                return find(key)->second;
                       ^
                       this->
CArtHandler.cpp:1298:24: note: in instantiation of member function
      'bmap<unsigned short, ArtSlotInfo>::operator[]' requested here
                return &artifactsWorn[pos];
                                     ^
In file included from CArtHandler.cpp:2:
In file included from ./../stdafx.h:18:
In file included from /usr/include/c++/4.5/map:60:
/usr/include/c++/4.5/bits/stl_map.h:696:7: note: must qualify identifier to find
      this declaration in dependent base class
      find(const key_type& __x)
      ^
/usr/include/c++/4.5/bits/stl_map.h:711:7: note: must qualify identifier to find
      this declaration in dependent base class
      find(const key_type& __x) const
      ^
1 error generated.
make[1]: *** [libvcmi_la-CArtHandler.lo] Error 1
make[1]: Leaving directory `/home/dimqua/vcmi/lib'
make: *** [all-recursive] Error 1
$ svn co https://vcmi.svn.sourceforge.net/svnroot/vcmi/trunk [^] vcmi
$ autoreconf -i
$ CXX=clang ./configure --datadir=/YOUR_INSTALL_PATH/ --bindir=/YOUR_INSTALL_PATH/vcmi --libdir=/YOUR_INSTALL_PATH/
$ make
svn revision 2235
clang 2.9
No tags attached.
patch bug766v1.patch (449) 2011-07-26 21:47
https://bugs.vcmi.eu/file_download.php?file_id=760&type=bug
Issue History
2011-07-05 18:05dimquaNew Issue
2011-07-26 21:42exineNote Added: 0001884
2011-07-26 21:47exineFile Added: bug766v1.patch
2011-07-27 19:41Tow dragonNote Added: 0001889
2011-07-31 14:03Tow dragonNote Added: 0001891
2011-07-31 14:15exineNote Added: 0001892
2011-09-02 00:33ubuntuxNote Added: 0001974
2011-09-02 00:33ubuntuxStatusnew => closed
2011-09-02 00:33ubuntuxAssigned To => ubuntux
2011-09-02 00:33ubuntuxResolutionopen => won't fix

Notes
(0001884)
exine   
2011-07-26 21:42   
This error was particularly simple to fix, but new error appeared:

Connection.cpp:409:15: error: no matching member function for call to 'registerVectoredType'
        CSerializer::registerVectoredType(&gs->map->artInstances, &CArtifactInstance::id);
        ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from Connection.cpp:3:
./Connection.h:262:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<T*> *Vector, const si32 T::*IdPtr)
             ^
./Connection.h:267:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<ConstTransitivePtr<T> > *Vector, const si32 T::*IdPtr)
             ^

And by the way, why is registerVectoredType() implemented in header?
(0001889)
Tow dragon   
2011-07-27 19:41   
@exine

registerVectoredType() is a template of member function. You cannot implement them in .cpp file without nasty tricks.

http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12 [^]
(0001891)
Tow dragon   
2011-07-31 14:03   
@exine

I think that error could be fixed by adding second template parameter:
template <typename T, typename U>
    void registerVectoredType(const std::vector<ConstTransitivePtr<T> > *Vector, const si32 U::*IdPtr)
(0001892)
exine   
2011-07-31 14:15   
@Tow dragon

I don't think so:

Connection.cpp:405:2: error: no matching member function for call to 'registerVectoredType'
        registerVectoredType(&gs->map->objects, &CGObjectInstance::id);
        ^~~~~~~~~~~~~~~~~~~~
In file included from Connection.cpp:3:
./Connection.h:262:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<T*> *Vector, const si32 U::*IdPtr)
             ^
./Connection.h:267:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<ConstTransitivePtr<T> > *Vector, const si32 U::*IdPtr)
             ^
Connection.cpp:406:2: error: no matching member function for call to 'registerVectoredType'
        registerVectoredType(&lib->heroh->heroes, &CHero::ID);
        ^~~~~~~~~~~~~~~~~~~~
In file included from Connection.cpp:3:
./Connection.h:262:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<T*> *Vector, const si32 U::*IdPtr)
             ^
./Connection.h:267:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<ConstTransitivePtr<T> > *Vector, const si32 U::*IdPtr)
             ^
Connection.cpp:407:2: error: no matching member function for call to 'registerVectoredType'
        registerVectoredType(&lib->creh->creatures, &CCreature::idNumber);
        ^~~~~~~~~~~~~~~~~~~~
In file included from Connection.cpp:3:
./Connection.h:262:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<T*> *Vector, const si32 U::*IdPtr)
             ^
./Connection.h:267:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<ConstTransitivePtr<T> > *Vector, const si32 U::*IdPtr)
             ^
Connection.cpp:408:2: error: no matching member function for call to 'registerVectoredType'
        registerVectoredType(&lib->arth->artifacts, &CArtifact::id);
        ^~~~~~~~~~~~~~~~~~~~
In file included from Connection.cpp:3:
./Connection.h:262:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<T*> *Vector, const si32 U::*IdPtr)
             ^
./Connection.h:267:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<ConstTransitivePtr<T> > *Vector, const si32 U::*IdPtr)
             ^
Connection.cpp:409:2: error: no matching member function for call to 'registerVectoredType'
        registerVectoredType(&gs->map->artInstances, &CArtifactInstance::id);
        ^~~~~~~~~~~~~~~~~~~~
In file included from Connection.cpp:3:
./Connection.h:262:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<T*> *Vector, const si32 U::*IdPtr)
             ^
./Connection.h:267:7: note: candidate template ignored: failed template argument deduction
        void registerVectoredType(const std::vector<ConstTransitivePtr<T> > *Vector, const si32 U::*IdPtr)
             ^
1 warning generated.
(0001974)
ubuntux   
2011-09-02 00:33   
Let's wait for clang to fix these issues. Not a real bug in vcmi, more like an annoyance.