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

QMap::value generates a compiler warning with the latest Apple Clang

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.6.0
    • None
    • Xcode 7.3

    Description

      The code has not changed since 2012, and the problem only appears when T is a pointer type.

      In file included from ../include/QtCore/qmap.h:1:
      ../include/QtCore/../../../../OpenSource/qt/qt5/qtbase/src/corelib/tools/qmap.h:648:27: warning: 
            returning address of local temporary object [-Wreturn-stack-address]
          return n ? n->value : adefaultValue;
                                ^~~~~~~~~~~~~
      /Users/jakepetroules/OpenSource/qt/qt5/qtbase/qmake/generators/win32/msvc_objectmodel.h:1054:32: note: 
            in instantiation of member function 'QMap<QString, TreeNode *>::value'
            requested here
              TreeNode *n = children.value(newNodeName);
                                     ^
      ../include/QtCore/../../../../OpenSource/qt/qt5/qtbase/src/corelib/tools/qmap.h:388:44: note: 
            binding reference variable 'adefaultValue' here
          const T value(const Key &key, const T &defaultValue = T()) const;
                                                 ^              ~~~
      ../include/QtCore/../../../../OpenSource/qt/qt5/qtbase/src/corelib/tools/qmap.h:648:27: warning: 
            returning address of local temporary object [-Wreturn-stack-address]
          return n ? n->value : adefaultValue;
                                ^~~~~~~~~~~~~
      /Users/jakepetroules/OpenSource/qt/qt5/qtbase/qmake/generators/win32/msbuild_objectmodel.h:85:33: note: 
            in instantiation of member function 'QMap<QString, XTreeNode *>::value'
            requested here
              XTreeNode *n = children.value(newNodeName);
                                      ^
      ../include/QtCore/../../../../OpenSource/qt/qt5/qtbase/src/corelib/tools/qmap.h:388:44: note: 
            binding reference variable 'adefaultValue' here
          const T value(const Key &key, const T &defaultValue = T()) const;
                                                 ^              ~~~
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            jakepetroules Jake Petroules (DO NOT ASSIGN ISSUES)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes