MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001890VCMIOtherpublic2014-09-13 09:482017-05-25 19:55
Reporterjosch 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Platformx86_64OSDebian GNU/LinuxOS Version8.0
Product Version 
Target VersionFixed in Version 
Summary0001890: warning: comparison between ‘enum QVariant::Type’ and ‘enum QMetaType::Type’
DescriptionWhen compiling vcmi I receive the following warning:

/home/josch/vcmi-orig/launcher/jsonutils.cpp: In function ‘JsonNode JsonUtils::toJson(QVariant)’:
/home/josch/vcmi-orig/launcher/jsonutils.cpp:87:39: warning: comparison between ‘enum QVariant::Type’ and ‘enum QMetaType::Type’ [-Wenum-compare]
  else if (object.type() == QMetaType::QString)
                                       ^
/home/josch/vcmi-orig/launcher/jsonutils.cpp:89:39: warning: comparison between ‘enum QVariant::Type’ and ‘enum QMetaType::Type’ [-Wenum-compare]
  else if (object.type() == QMetaType::Bool)
                                       ^
Steps To Reproduce$ cmake -DCMAKE_VERBOSE_MAKEFILE=true .
$ make
[...]
[100%] Building CXX object launcher/CMakeFiles/vcmilauncher.dir/jsonutils.cpp.o
cd /home/josch/vcmi-orig/launcher && /usr/bin/c++ -DM_BIN_DIR=\"/usr/local/bin\" -DM_DATA_DIR=\"/usr/local/share/vcmi\" -DM_LIB_DIR=\"/usr/local/lib/x86_64-linux-gnu/vcmi\" -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DUSE_SYSTEM_MINIZIP -fPIE -std=c++0x -Wall -Wextra -Wpointer-arith -Wno-strict-aliasing -Wno-switch -Wno-sign-compare -Wno-unused-local-typedefs -Wno-unused-parameter -Wuninitialized -Wno-overloaded-virtual -Wno-type-limits -fvisibility=hidden -O2 -g -DNDEBUG -fPIE -I/home/josch/vcmi-orig/launcher -I/home/josch/vcmi-orig -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -o CMakeFiles/vcmilauncher.dir/jsonutils.cpp.o -c /home/josch/vcmi-orig/launcher/jsonutils.cpp
/home/josch/vcmi-orig/launcher/jsonutils.cpp: In function ‘JsonNode JsonUtils::toJson(QVariant)’:
/home/josch/vcmi-orig/launcher/jsonutils.cpp:87:39: warning: comparison between ‘enum QVariant::Type’ and ‘enum QMetaType::Type’ [-Wenum-compare]
  else if (object.type() == QMetaType::QString)
                                       ^
/home/josch/vcmi-orig/launcher/jsonutils.cpp:89:39: warning: comparison between ‘enum QVariant::Type’ and ‘enum QMetaType::Type’ [-Wenum-compare]
  else if (object.type() == QMetaType::Bool)
                                       ^
/usr/bin/cmake -E cmake_progress_report /home/josch/vcmi-orig/CMakeFiles
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004948)
Ivan (developer)
2014-09-13 14:51

Not a bug or to be precise - not our bug. Docs for this method from Qt:

http://qt-project.org/doc/qt-4.8/qvariant.html#type [^]
>> Returns the storage type of the value stored in the variant. Although this function is declared as returning QVariant::Type, the return value should be interpreted as QMetaType::Type.
(0004949)
josch (developer)
2014-09-13 16:26

Then you should explicitly cast from "enum QVariant::Type" to "enum QMetaType::Type" to inform the compiler that "yes, I really want this to interpreted that way".
(0007044)
Chocimier (developer)
2017-05-25 19:55

Fixed:
https://github.com/vcmi/vcmi/commit/a3d4f9d22fd7de4715d8a0f9b3ab15b2fc2f8e96 [^]

- Issue History
Date Modified Username Field Change
2014-09-13 09:48 josch New Issue
2014-09-13 14:51 Ivan Note Added: 0004948
2014-09-13 16:26 josch Note Added: 0004949
2017-05-25 19:55 Chocimier Note Added: 0007044
2017-05-25 19:55 Chocimier Status new => resolved
2017-05-25 19:55 Chocimier Resolution open => fixed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2020 MantisBT Team
Hosting provided by DigitalOcean