From c7deb3400faa1d9389137fe63ffbffade8203850 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 21 Mar 2021 13:57:48 -0700 Subject: QUtf8StringView: ensure binary compatibility throughout 6.x We can't depend on whether the user compiles with -std=c++17 or -std=c++20. So select what we can depend on and make that permanent. Prior to this change: $ cat /tmp/test.cpp #include void f(QUtf8StringView) {} $ qcd include $ g++ -S -o - -I. /tmp/test.cpp | grep globl | c++filt .globl f(QBasicUtf8StringView) $ g++ -fPIC -std=c++20 -S -o - -I. /tmp/test.cpp | grep globl | c++filt .globl f(QBasicUtf8StringView) After this change, they're both "false". QUtf8StringView should have been a concrete class that derived from QBsicUtf8StringView and inherited all its constructors. We'd cause ODR violations in C++20, but nothing worse than what we usually do for BC reasons. That solution is too late for Qt 6.x. Let's revisit in 7.0. Pick-to: 6.1 dev Change-Id: I6bcbe88c072a438b8b4efffd166e77199ecb39e3 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/text/qutf8stringview.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/text/qutf8stringview.h') diff --git a/src/corelib/text/qutf8stringview.h b/src/corelib/text/qutf8stringview.h index 8e0656660d..e448667ae1 100644 --- a/src/corelib/text/qutf8stringview.h +++ b/src/corelib/text/qutf8stringview.h @@ -359,6 +359,7 @@ private: template Q_DECLARE_TYPEINFO_BODY(QBasicUtf8StringView, Q_PRIMITIVE_TYPE); +// ### Qt 7: remove the non-char8_t version of QUtf8StringView QT_BEGIN_NO_CHAR8_T_NAMESPACE using QUtf8StringView = QBasicUtf8StringView; QT_END_NO_CHAR8_T_NAMESPACE -- cgit v1.2.3