Workaround MSVC 2022 bug about QString::replace

MSVC 2022 (17.0.0) complains about "'QString::replace':
12 overloads have no legal conversion for 'this' pointer".
This is a compiler bug. It is reported to MS. Still we workaround
it here so that qtbase can be built with MSVC 2022.

Pick-to: 6.2
Task-number: QTBUG-96975
Change-Id: I0180e2e6760d2809ca61e3cd8f02b04f970172a7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Andreas Buhr 2021-11-10 08:57:19 +01:00 committed by Andreas Buhr
parent 6652bf2353
commit 30a70fc6e0

View File

@ -1329,12 +1329,15 @@ void tst_QUrl::fromLocalFile_data()
<< QString(suffix);
#ifdef Q_OS_WIN32
// debackslashification only happens on Windows
QString suffixWithBackslashes(suffix);
suffixWithBackslashes.replace('/', '\\');
QTest::addRow("windows-backslash-unc-%s", pathDescription)
<< QString(QString("//somehost") + suffix).replace('/', '\\')
<< QString(QString("\\\\somehost") + suffixWithBackslashes)
<< QString("file://somehost") + suffix
<< QString(suffix);
QTest::addRow("windows-backslash-extlen-%s", pathDescription)
<< QString(QString("//?") + suffix).replace('/', '\\')
<< QString(QString("\\\\?") + suffixWithBackslashes)
<< QString("file:////%3F") + suffix
<< QString("//?") + suffix;
#endif