Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31516

Windows, MSVC2010+: Warning C4718 with QMap when using /W 4

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4: Low P4: Low
    • None
    • 5.0.2
    • None
    • Windows 7, VS2010

      Setting the warning level to 4 on VC2010 produces warning C4718 with QMap when the key and value are of C++ data type:

      1>d:\5.0.2\include\qtcore\qmap.h(234): warning C4718: 'QMapNode<int,int>::destroySubTree' : recursive call has no side effects, deleting
      1>d:\5.0.2\include\qtcore\qmap.h(332): warning C4718: 'QMapNode<int,int>::destroySubTree' : recursive call has no side effects, deleting
      1>d:\test\main.cpp(8): warning C4718: 'QMapNode<int,int>::destroySubTree' : recursive call has no side effects, deleting
      1>d:\test\main.cpp(17): warning C4718: 'QMapNode<int,int>::destroySubTree' : recursive call has no side effects, deleting
      

      This was not the case with Qt 4. With a Qt class, like QString, the warning is not displayed.

      The code below can be used to reproduce the issue.

      #include <QtCore/QCoreApplication>
      #include <QtCore/QMap>
      
      class Test
      {
          public:
          Test() {}
          ~Test() {}
          QMap<int, int> m;
      };
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          Test t;
          return a.exec();
      }
      

        1. qtbug31516.tar
          10 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            qtcomsupport Qt Support
            Votes:
            7 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes