Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.3.2
-
None
-
Windows 7 64-bit, compiling with MSVC 2013, using 64-bit Qt 5
-
ca4b9f624a41aa656e1d336ea48ec50fe53fa17e
Description
On 64-bit MSVC compilations, when using the QSet<> initializer list constructor, size conversion warnings are emitted.
This is because std::initializer_list<>::size() returns the size_t type, whereas the QSet<>::reserve method takes an int.
#include <QCoreApplication> #include <QSet> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QSet<int> list = {1, 2, 3, 4}; // CONFIG += c++11 return a.exec(); }
Output:
c:\qt\qt5.3.2\5.3\msvc2013_64\include\qtcore\qset.h(63) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
c:\qt\qt5.3.2\5.3\msvc2013_64\include\qtcore\qset.h(61) : while compiling class template member function 'QSet<int>::QSet(std::initializer_list<T>)'
with
[
T=int
]
..\TestWarnings\main.cpp(9) : see reference to function template instantiation 'QSet<int>::QSet(std::initializer_list<T>)' being compiled
with
[
T=int
]
..\TestWarnings\main.cpp(9) : see reference to class template instantiation 'QSet<int>' being compiled