Quoting -Wmarc: "The values of keys in an associated container are not supposed to change over time, thus they are marked as const in the std containers. But some types can change their values under the hood while being stored as const. Examples of such types as QPointer, weak_ptr, QWeakPointer, but also QPersistentModelIndex. As they change, the container's class invariants are broken (order in sorted and hash value unordered associative containers), and accessing such a container results in undefined behaviour." Reproducible: Always
Git commit 82804b42907232c3c163028b5d42fe61b29cf5e9 by Sergio Martins. Committed on 24/07/2016 at 22:52. Pushed by smartins into branch 'master'. new check: mutable-container-key Looks for associative containers that have a key which value can change. QPointer or QWeakPointer are examples of such types M +1 -0 CMakeLists.txt A +5 -0 checks/level0/README-mutable-container-key.md A +72 -0 checks/level0/mutable-container-key.cpp [License: LGPL (v2+)] A +39 -0 checks/level0/mutable-container-key.h [License: LGPL (v2+)] M +11 -11 tests/clazy/test_requested_checks.sh.expected A +7 -0 tests/mutable-container-key/config.json A +26 -0 tests/mutable-container-key/main.cpp [License: UNKNOWN] * A +5 -0 tests/mutable-container-key/main.cpp.expected The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page. http://commits.kde.org/clazy/82804b42907232c3c163028b5d42fe61b29cf5e9