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

'QMap::operator[](const Key &key) const' should return 'const' value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • 6.3.2
    • None
    • All

    Description

      Since Qt 6 (https://codereview.qt-project.org/c/qt/qtbase/+/297563),
      QMap::operator[](const Key &key) const declaration has been changed and
      began to return a non-constant value. This can lead to unexpected bugs in user code,
      which are no longer detected by the compiler (as it was in Qt 5).

      const QVariantMap map;
      ...
      map["someKey"] = someValue; // now it's compiled!
      ...
      

      See https://codereview.qt-project.org/c/qt/qtbase/+/297563/comment/0ed12f8d_581ffbc7/

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              studiosus Vladimir Belyavsky
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes