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

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

XMLWordPrintable

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

      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/

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes