From 44da43e8e42272c61cf12c05314387c785bd9749 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 22 Jun 2020 11:44:34 +0200 Subject: QString: add char8_t overload of fromUtf8() Use the overload-with-template trick from P1423 to avoid ambiguities when existing callers pass 0 or nullptr. Add a qdoc-ignored macro to hide the fact that the overload is a template. [ChangeLog][QtCore][QString] Added char8_t overload of fromUtf8(). Change-Id: Iaa2d365bfa161ef36cc73fa3bad50aabf34d01db Reviewed-by: Thiago Macieira --- tests/auto/corelib/text/qstring/tst_qstring.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto/corelib/text/qstring/tst_qstring.cpp') diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 5c46ae6ae1..61f775f4d8 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -4216,9 +4216,15 @@ void tst_QString::nullFromUtf8() a = QString::fromUtf8(0); QVERIFY(a.isNull()); QVERIFY(a.isEmpty()); + a = QString::fromUtf8(nullptr); + QVERIFY(a.isNull()); + QVERIFY(a.isEmpty()); a = QString::fromUtf8(""); QVERIFY(!a.isNull()); QVERIFY(a.isEmpty()); + a = QString::fromUtf8(u8""); // char in C++17 / char8_t in C++20 + QVERIFY(!a.isNull()); + QVERIFY(a.isEmpty()); a = QString::fromUtf8(QByteArray()); QVERIFY(a.isNull()); QVERIFY(a.isEmpty()); -- cgit v1.2.3