[Development] Raising the minimum to C++20

Thiago Macieira thiago.macieira at intel.com
Wed May 3 02:39:01 CEST 2023


C++23 is on the way, so maybe it's time for us to raise our minimum to the one 
version before that. Let's aim for Qt 6.7, because feature-freeze for 6.6 is 
within one month, and lets us warn our users this is coming.

By this, I mean to:
* modify our build system so Qt compiles with -std=c++20 or equivalent
* require that user code compiling Qt headers be similarly done
* remove the requirement for #if checks for C++17 Standard Library features
* make a couple of C++20 features mandatory (see below)

Of the C++20 features I currently see a good reason to make mandatory:
* feature-test macros (no change: we're already using them)
* spaceship operator and <compare> header
* char8_t
* std::is_constant_evaluated()
* constinit
* <bit> header
* (maybe) designated initialisers
* (maybe) constexpr from <algorithm> and <utility>

I'm not proposing modules, concepts or coroutines be allowed in our code just 
yet. I think concepts will be the first of those, but we need to understand how 
to use them first and how our code will change. I'd love to require std::format 
and std::source_location, but those don't seem to be ready in the proposed 
versions above.

For this, I'd also like to request we raise our minimum compiler versions to:
* GCC 10 (released May 2020)
* Clang 10 (released March 2020)
* MSVC 2022 that is current today
* XCode that is current today

Clang and GCC will be, at the time of Qt 6.7's release, just under 4 years 
old. That should be enough to have been included in any long-term support 
Linux distribution. Currently, both SLE 15.4 and RHEL/RockyLinux 9 have GCC 
13, while Ubuntu 22.04 and Debian 11 (current stable) have GCC 11. Debian will 
probably release its next stable before Qt 6.7, though whether it'll still 
upgrade from GCC 12 to 13 I don't know. When we released Qt 6.0, our minimum 
of GCC 8 was of a lower age, at 2.5 years, so we could reasonably bump our 
minimum GCC to 11 and still be 6 months more lenient. There are no new 
features in GCC 11 that we could use without also requiring a more recent 
Clang.

Speaking of Clang, I simply chose a contemporaneous version and one that had a 
similar feature list. FreeBSD 13-STABLE (13.2) comes with Clang 14, which is 
much newer. We could raise the minimum if we wanted, but the intersection of 
features with GCC 10 or 11 doesn't change much; we get std::bit_cast with 
Clang/libc++ 14, but that's about it.

This proposal also drops MSVC 2019 and assumes that users of 2022, like XCode, 
keep their compilers reasonably up-to-date. That is, that they'll update to 
the latest at least once in the next 10 months.

I don't have access to QNX and INTEGRITY toolchain information, so I'd like to 
request that they simply match the feature list above, with minimal 
workarounds.

Opinions?
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230502/cb6d7926/attachment.bin>


More information about the Development mailing list