Operator == takes references and those can never be 0 according to the standard.
So the code "if (!!&a != !!&b) return false;" (and similar), which was apparently meant to handle null referrences, is going to get optimized out.
The introduction of null referrences by calling operator == on dereferenced pointers is actually undefined behavior.
The clang compiler also warns about this issue:
.../src/shared/qbs/src/lib/corelib/language/resolvedfilecontext.cpp:78: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!!&a != !!&b)
~ ^
For Gerrit Dashboard: QBS-674 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
93236,3 | Fix equality operators. | 1.3 | qbs/qbs | Status: MERGED | +2 | 0 |