woboq / verdigris

Qt without moc: set of macros to use Qt without needing moc
https://woboq.com/blog/verdigris-qt-without-moc.html
GNU Lesser General Public License v3.0
643 stars 60 forks source link

Warning when compiling wobjectimpl.h: C4307: '+': integral constant overflow #72

Closed nyanpasu64 closed 5 years ago

nyanpasu64 commented 5 years ago

I'm compiling https://github.com/woboq/verdigris/releases/tag/v1.2 on MSVC 2019 x64 on Qt Creator using CMake. I get the following warning:

...\3rdparty\verdigris\wobjectimpl.h:755: warning: C4307: '+': integral constant overflow
...\3rdparty\verdigris\wobjectimpl.h:764: see reference to class template instantiation 'w_internal::MetaDataProvider<T>' being compiled
...\3rdparty\verdigris\wobjectimpl.h:825: see reference to class template instantiation 'w_internal::MetaDataBuilder<T,std::integer_sequence<unsigned __int64,0,1>>' being compiled
...\src\gui\main_window.cpp:36: see reference to function template instantiation 'QMetaObject w_internal::FriendHelper::createMetaObject<MainWindow::W_ThisType>(void)' being compiled

This warning occurs once for each class using Verdigris. The program works though.

ogoffart commented 5 years ago

I'd like to fix this warning, but the line in question is

constexpr static Arrays arrays = buildArrays();

Which does not contains any arithmetic operations by itself. So that means that the warning is somewhere in buildArrays(), but since that's a quite big function, i don't really know what causes the warning exactly.

nyanpasu64 commented 5 years ago

By commenting out parts of buildArrays()...

ogoffart commented 5 years ago

Ok, by trial error using the CI, I found out the problem. And it is fixed with commit 14dd84c 46aab40

Thanks for reporting.