semlanik / qtprotobuf

Protobuf generator and bindings for Qt framework
https://semlanik.github.io/qtprotobuf
MIT License
169 stars 38 forks source link

error: specialization of ‘template in different namespace in qprotobufserializer.cpp #270

Closed NikolaiBirolini closed 2 years ago

NikolaiBirolini commented 2 years ago

Hello again ! I have another issue with another cmake build. I swear, this is the last time !

Describe the bug When I launch the final cmake to build the examples, I have an error related with templates in qprotobufserializer.cpp.

To Reproduce I'm on the final step in the mainpage :

cmake --build . [--config <RELEASE|DEBUG>] -- -j

I entered :

sudo cmake --build . --config RELEASE -j4

Environment:

cmake output qtprotobuf/src/protobuf/qprotobufserializer.cpp:35:121: error: specialization of ‘template<class V, typename std::enable_if<(!(std::is_same<T, QString>::value || std::is_base_of<QObject, T>::value)), int>::type > static QByteArray QtProtobuf::QProtobufSerializerPrivate::serializeListType(const QList&, int&)’ in different namespace [-fpermissive] QByteArray QProtobufSerializerPrivate::serializeListType(const QByteArrayList &listValue, int &outFieldIndex) ^ In file included from /qtprotobuf/src/protobuf/qprotobufserializer.cpp:27:0: /qtprotobuf/src/protobuf/qprotobufserializer_p.h:230:23: error: from definition of ‘template<class V, typename std::enable_if<(!(std::is_same<T, QString>::value || std::is_base_of<QObject, T>::value)), int>::type > static QByteArray QtProtobuf::QProtobufSerializerPrivate::serializeListType(const QList&, int&)’ [-fpermissive] static QByteArray serializeListType(const QList &listValue, int &outFieldIndex) {

I thank you in advance for your help !

semlanik commented 2 years ago

Hmmm, quite a weird error, especially because I've never seen it before. I suspect it's something compiler-specific. Anyway please check: https://github.com/semlanik/qtprotobuf/pull/269/commits/4b74b403c2996b638255e46bb2da110ee99139a7 The follow-up fixes might be similar. Thanks!

NikolaiBirolini commented 2 years ago

Thank you ! It worked !