- 
    
Bug
 - 
    Resolution: Unresolved
 - 
    
P3: Somewhat important
 - 
    None
 - 
    5.6.1
 - 
    None
 
The following code compiles, but it doesn't set change object because it is const:
const QJsonObject object; object["foo"] = "bar";
It doesn't look too harmful in the example above, but if there are just a few statements between the two statements in the example it becomes a nasty trap.
In Qt-6, QJsonObject::operator[](const QString &) and QJsonArray::operator[](int) should return a const-ref object to eliminate this trap.
- relates to
 - 
                    
QTBUG-99337 QJsonArray and QJsonObject const iterators allow modification
-         
 - Closed
 
 -