Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QStringView: refuse construction from QStringRef
When QStringRef was moved out of QtCore, it was also incorrectly removed from the if_compatible_container constraint, causing QStringView{sr} to still match the general container QStringView ctor overload, which doesn't preserve null'ness if data() doesn't return null. By refusing to provide a constructor from QStringRef, we force the compiler to use QStringRef's implicit conversion operators instead. This transitively affects QAnyStringView in the same way. The tests can, naturally, only be in qt5compat, so define a macro to communicate to tst_QStringRef whether it compiles against a fixed QtCore or not. Fixes: QTBUG-122797 Fixes: QTBUG-122798 Pick-to: 6.8 6.5 Change-Id: I64b75a8e421d2b6185615e3288ce3ad7fd8f15f9 Reviewed-by: Ahmad Samir <[email protected]> (cherry picked from commit a0e6539) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
- Loading branch information