Warnings in Visual studio project when using QT 6.6.3 MSVC2019_64 build.
-
wrote on 5 Jul 2024, 10:34 last edited by
Hello All,
I have a project which I recently updated with QT6. The project compiles and runs without any issue. In my earlier posts I have shared one problem which I faced in this updating process and what workaround worked for me. Apart from that no specific changes I have done. I am getting around 50 warnings in my project. I have read on QT forum the similar post and looks like it is still open.
QtQTBUG-75006
Visual Studio 2019 with Qt: VS2019 detects many warnings on Qt LibraryBelow warnings I am seeing
C:\Qt\6.6.3\msvc2019_64\include\QtCore\qanystringview.h(346): warning C26813: Use 'bitwise and' to check if a flag is set. C:\Qt\6.6.3\msvc2019_64\include\QtCore\qanystringview.h(348): warning C26813: Use 'bitwise and' to check if a flag is set. C:\Qt\6.6.3\msvc2019_64\include\QtCore\qfloat16.h(60): warning C26495: Variable 'qfloat16::<unnamed-tag>::b16' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qcolor.h(217): warning C26495: Variable 'QColor::CT::ahsv' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qcolor.h(217): warning C26495: Variable 'QColor::CT::argbExtended' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qcolor.h(217): warning C26495: Variable 'QColor::CT::argb' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qcolor.h(217): warning C26495: Variable 'QColor::CT::acmyk' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qcolor.h(217): warning C26495: Variable 'QColor::CT::array' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qcolor.h(217): warning C26495: Variable 'QColor::CT::ahsl' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qtransform.h(31): warning C26495: Variable 'QTransform::m_matrix' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qtransform.h(31): warning C26495: Variable 'QTransform::m_type' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qtransform.h(31): warning C26495: Variable 'QTransform::m_dirty' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qsharedpointer_impl.h(111): warning C26495: Variable 'QtSharedPointer::ExternalRefCountData::destroyer' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qvariant.h(82): warning C26495: Variable 'QVariant::PrivateShared::offset' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtWidgets\qsizepolicy.h(64): warning C26813: Use 'bitwise and' to check if a flag is set. C:\Qt\6.6.3\msvc2019_64\include\QtCore\qarraydataops.h(704): warning C26495: Variable 'QtPrivate::QMovableArrayOps<QString>::Inserter::displaceFrom' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qarraydataops.h(704): warning C26495: Variable 'QtPrivate::QMovableArrayOps<QString>::Inserter::bytes' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qarraydataops.h(704): warning C26495: Variable 'QtPrivate::QMovableArrayOps<QString>::Inserter::displaceTo' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qvectornd.h(34): warning C26495: Variable 'QVector2D::v' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qvectornd.h(174): warning C26495: Variable 'QVector3D::v' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtGui\qvectornd.h(333): warning C26495: Variable 'QVector4D::v' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QTGUI\qquaternion.h(24): warning C26495: Variable 'QQuaternion::xp' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QTGUI\qquaternion.h(24): warning C26495: Variable 'QQuaternion::yp' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QTGUI\qquaternion.h(24): warning C26495: Variable 'QQuaternion::zp' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QTGUI\qquaternion.h(24): warning C26495: Variable 'QQuaternion::wp' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\quuid.h(32): warning C26495: Variable 'QUuid::data3' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\quuid.h(32): warning C26495: Variable 'QUuid::data4' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\quuid.h(32): warning C26495: Variable 'QUuid::data1' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\quuid.h(32): warning C26495: Variable 'QUuid::data2' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qarraydataops.h(704): warning C26495: Variable 'QtPrivate::QMovableArrayOps<QKeySequence>::Inserter::displaceTo' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qarraydataops.h(704): warning C26495: Variable 'QtPrivate::QMovableArrayOps<QKeySequence>::Inserter::bytes' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qarraydataops.h(704): warning C26495: Variable 'QtPrivate::QMovableArrayOps<QKeySequence>::Inserter::displaceFrom' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qbytearraymatcher.h(86): warning C26498: The function 'std::numeric_limits<unsigned char>::max' is constexpr, mark variable 'uchar_max' constexpr if compile-time evaluation is desired (con.5). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qiterable.h(139): warning C26439: This kind of function should not throw. Declare it 'noexcept' (f.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qcontainertools_impl.h(169): warning C26495: Variable 'QtPrivate::q_relocate_overlap_n_left_move::Destructor::intermediate' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qarraydataops.h(704): warning C26495: Variable 'QtPrivate::QMovableArrayOps<QIcon>::Inserter::displaceFrom' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qarraydataops.h(704): warning C26495: Variable 'QtPrivate::QMovableArrayOps<QIcon>::Inserter::bytes' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qarraydataops.h(704): warning C26495: Variable 'QtPrivate::QMovableArrayOps<QIcon>::Inserter::displaceTo' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qhash.h(179): warning C26495: Variable 'QHashPrivate::MultiNode<int,BITPART *>::value' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtConcurrent\qtconcurrentreducekernel.h(64): warning C26495: Variable 'QtConcurrent::IntermediateResults<CUTRESULTS *>::begin' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtConcurrent\qtconcurrentreducekernel.h(64): warning C26495: Variable 'QtConcurrent::IntermediateResults<CUTRESULTS *>::end' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qhash.h(173): warning C26439: This kind of function should not throw. Declare it 'noexcept' (f.6). C:\Qt\6.6.3\msvc2019_64\include\QtConcurrent\qtconcurrentiteratekernel.h(60): warning C26495: Variable 'QtConcurrent::ResultReporter<CUTRESULTS>::currentResultCount' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qmap.h(145): warning C26495: Variable 'QMapData<std::map<int,QtConcurrent::IntermediateResults<CUTRESULTS *>,std::less<int>,std::allocator<std::pair<int const ,QtConcurrent::IntermediateResults<CUTRESULTS *> > > > >::EraseResult::data' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qhash.h(179): warning C26495: Variable 'QHashPrivate::MultiNode<int,VERTEX *>::value' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qcontainertools_impl.h(146): warning C6031: Return value ignored: 'std::reverse_iterator<ADJUSTED_GOVERNOR_PARAM *>::->'. C:\Qt\6.6.3\msvc2019_64\include\QtCore\qcontainertools_impl.h(220): warning C6031: Return value ignored: 'std::reverse_iterator<ADJUSTED_GOVERNOR_PARAM *>::->'. C:\Qt\6.6.3\msvc2019_64\include\QtCore\qmap.h(145): warning C26495: Variable 'QMapData<std::map<int,int *,std::less<int>,std::allocator<std::pair<int const ,int *> > > >::EraseResult::data' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qhash.h(179): warning C26495: Variable 'QHashPrivate::MultiNode<int,TRIANGLE *>::value' is uninitialized. Always initialize a member variable (type.6). C:\Qt\6.6.3\msvc2019_64\include\QtCore\qhash.h(179): warning C26495: Variable 'QHashPrivate::MultiNode<int,SURFACE *>::value' is uninitialized. Always initialize a member variable (type.6).
Are all these warnings expected or is there any way to suppress this ?
Any guidance on this is appreciated.Thanks,
OnkarPS : I found this bug also which mentioned about similar warning.
QtQTBUG-85644
defaulted default constructor cannot be constexpr because the corresponding implicitly declared default constructor would not be constexpr -
What exact Visual Studio do you use? Update to the latest.
The bug you mention is for icc, not msvc and for Qt5 - I doubt it will help you.Also try with a simply main.cpp which only includes and use e.g. QCoreApplication if the problem can be reproduced there.
-
wrote on 5 Jul 2024, 13:21 last edited by
I am using Microsoft Visual studio community 2022 and version is 17.10.2.
In simple application also I am seeing the warning.
#include <iostream> #include <QtCore/qcoreapplication.h> #include <QtCore/qlist.h> #include <QtCore/qvariant.h> bool DoSomeManipulation() { QVariant test; // Creating a QStringList QStringList fruits; // Adding items to the list fruits << "Apple" << "Banana" << "Cherry" << "Date"; return true; } int main(int argc, char* argv[]) { QCoreApplication app(argc, argv); bool t = DoSomeManipulation(); bool t1 = DoSomeManipulation(); bool t2 = DoSomeManipulation(); return app.exec(); }
Used above sample code to create the application and it also shows warnings.
-
Did you enable more warnings? I don't get them here.
Others also complain about them: https://developercommunity.visualstudio.com/t/C26813-Bitwise-Enum-VS2022-C-warnin/10612067?entry=myfeedback&sort=newest -
wrote on 8 Jul 2024, 06:54 last edited by
No. My warning levels are default kept to W1.
Yes. I have also checked the same article and just want to confirm whether these warnings are really a problem for long term or not.
Addition to your shared post above I came across below links related to warnings I am seeing.
[https://developercommunity.visualstudio.com/t/intellisense-error-e2422-for-dllimport-constexpr-d/1589205](link url)[https://bugreports.qt.io/browse/QTBUG-85644](link url)
[https://bugreports.qt.io/browse/QTBUG-75006](link url)
Regards,
Onkar
1/5