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

QMapNode and strict-aliasing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.15.1
    • None
    • Linux/X11
    • 6e60921290892ac0fcf625c5025845eb0334880e (qt/qtbase/5.15)

    Description

      Latest GCC 10.2 in latest Qt found reinterpret-cast<> as:

      /usr/include/qt/QtCore/qmap.h:212: error: dereferencing type-punned pointer might break strict-aliasing rules [-Werror=strict-aliasing]
      /usr/include/qt/QtCore/qmap.h:863:35: required from ‘QMap<K, V>::iterator QMap<K, V>::find(const Key&) [with Key = QString; T = QString]’
      ../ed_highway/stringsfilecache.cpp:243:42: required from here
      /usr/include/qt/QtCore/qmap.h:212:52: error: dereferencing type-punned pointer might break strict-aliasing rules [-Werror=strict-aliasing]
       212 | Node *end() \{ return reinterpret_cast<Node *>(&header); }
       | ^~~~~~
      

       

      Declaration as:

      QMap<QString, QString> key2filename{}
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            alexzk_ alexzk_
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes