diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-06-13 23:25:18 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-06-15 18:40:24 +0200 |
commit | f2bd46d1df587a3d9eac485c5e98caa98b12909d (patch) | |
tree | 0fd7a6d3614d0c6e783469dffa6e44d8a9f1a1f8 /src/corelib/io/qipaddress_p.h | |
parent | 079dafc42fdfddbc6bff7d343463e16151afeb2d (diff) |
Fix deep-const-correctness of qGetPtrHelper() for smart pointers
The function qGetPtrHelper() is mainly used to implement d_func() within
the Q_DECLARE_PRIVATE() macro. The whole purpose of d_func() is to
propagate const deeply. But if a smart pointer implements this by itself,
then the old version of qGetPtrHelper(), by taking the Ptr as a const-&,
would always return a const payload pointer, which would fail in the
following reinterpret_cast in d_func() to mutable payloads.
This was found while experimenting with making QExplicitlySharedDataPointer
deep const-correct, and I have no explanation why it seems to have worked
with QSharedDataPointer, which is deep-const-correct already.
Change-Id: Iee2e8fcce89c58ba2af7818de6f79ed39c5a4030
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qipaddress_p.h')
0 files changed, 0 insertions, 0 deletions