path: root/tests
diff options
authorPavel Tumakaev <p.tumakaev@lgepartner.com>2019-05-22 17:32:25 +0300
committerPavel Tumakaev <p.tumakaev@lgepartner.com>2019-05-23 12:22:34 +0300
commit19ca4af1a248486844ea9bf96eba62ce564ecdc9 (patch)
tree09df8162e363e565d0c03d98b40b26f1f5ed5733 /tests
parent4ce9717c6de3f69556b90d97c40fcfc5bb54b6d4 (diff)
Remove null pointer checks for "this" from QQmlContextData::resolvedUrl()
According to ISO/IEC 14882 §5.2.5/3 "If E1 has the type “pointer to class X,” then the expression E1->E2 is converted to the equivalent form (*(E1)).E2;". Thus, as QQmlContextData::resolvedUrl() is non-static method, it cannot be called on a null pointer because it leads to undefined behavior, and “this“ in QQmlContextData::resolvedUrl() cannot be a null pointer. According to this document: https://gcc.gnu.org/gcc-6/porting_to.html , starting from version 6, GCC optimizations remove null pointer checks for "this", since "the this pointer can never be null, which is guaranteed by the language rules." Thus, on the one hand the “if (ctxt)“ check in QQmlContextData::resolvedUrl() does nothing, on the other “if (engine“ check leads to undefined behavior if ctxt/this == nullptr. Task-number: QTBUG-75983 Change-Id: Idfb1e26758d83223bb0845139d63e2e8e80dc714 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions