On 31.01.09 13:44:51, Andreas Pakulat wrote: > On 31.01.09 02:46:45, Patrick Spendrin wrote: > > Andreas Pakulat schrieb: > > > Hi, > > > > > > I've got a tricky problem here and templates are still mysterious to me > > > outside of the usage of QMap/QList&Co. > > > > > > If you look at > > > http://websvn.kde.org/trunk/KDE/kdevelop/plugins/languages/cpp/cppduchain/templatedeclaration.cpp?view=markup > > > http://websvn.kde.org/trunk/KDE/kdevelop/plugins/languages/cpp/cppduchain/templatedeclaration.h?view=markup > > > > > > You'll see > > > virtual Declaration* resolve(const TopDUContext* /*topContext*/) const > > > around line 273 in the header and a specialization of this method in line > > > 1021. As you can see the function in the header asserts in all cases, the > > > specialization does something useful. > > > > > > Unfortunately for me MSVC always resolves to the non-specialized version > > > in > > > the header. The template parameter matches as far as I can see during > > > debugging (no backtrace at hand right now), but msvc still uses the wrong > > > one. > > > > > > I could "fix" it by moving the specialization into the header file, but > > > that breaks compilation on linux/gcc. > > > > > > Anybody have a hint for me whats going wrong here and why MSVC doesn't see > > > the specialization in the .cpp? > > What looks not right is that the template class should get exported. > > Normally template classes do not get exported (compare Qt > > QVector/QList), so I wonder why this should be needed here. > > I am not sure how this should change anything though as you say it > > compiles fine. > > Hmm, but maybe thats the reason it doesn't build on linux anymore when the > specialization is moved to the header... I'll try removing the export-macro > and see wether that fixes compilation on linux...
Of course it was not :) But hopefully the solution is as easy as: Forward declare the function in the header, but keep the definition in the .cpp. I couldn't test on msvc and as I still don't understand why it didn't see the specialization in the .cpp file I can't be sure it works. But I think chances are good it does :) Andreas -- Your aim is high and to the right. _______________________________________________ Kde-windows mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-windows
