[Development] Proposing to officially allow C++20 types in Qt 6 ABIs

Thiago Macieira thiago.macieira at intel.com
Tue Feb 1 01:53:56 CET 2022

On Monday, 31 January 2022 10:44:07 PST Giuseppe D'Angelo via Development 
> I was referring to the "defaulting to C++-latest". In order to know what
> *is* the "latest" you can target, you need to detect the CMake and the
> compiler versions. That means start building tables of supported
> combinations. Probably nothing too complicated, still, work to do.

> That's an orthogonal decision. Bumping the minimum requirement of Qt to
> C++20 will simply reopen the same questions for C++23, won't it?

Not exactly, because of the difference between incoming and outgoing ABI.

If we allow C++2N symbols in *our* ABI, then those must always be present in a 
supported build (if you don't want support, you can do whatever you want). If 
that implies raising the minimum compiler version or minimum CMake version, 
therefore dropping support for older OS environments, then so be it. That's 
our choice.

But we can allow use of C++2N symbols in the ABI we *use*, if those were 
detected during the build. Downgrading the compiler and its C++ standard 
library is not supported neither by us nor by the compiler vendors, so we can 
be assured that this build of Qt will be run against the same version or 
newer. Those symbols will be present. They just can't be mandatory for all 
source builds.

> So, concretely, this just means: use feature macros to guard the
> relevant APIs. The C++17 project won't see the APIs as available, so it
> can't use them, and won't get no compile errors.

Correct, provided Qt was compiled with C++20.

> > I'd say no. That was my reply to Lars just now and the gist of my
> > opposition
> > to Marc's initial proposal: a C++17 build of Qt is an unsupported "send
> > patches, not bug reports" build.
> Is this a "no" to the better QoI, or to the overall idea of making a
> C++17 build of Qt work with a C++-latest project?

To be clear: I don't mind saying that Qt now requires C++20 to build. That's 
our choice to make and I'll abstain from going either way.

However, I do mind the ABI. It must be the same for all supported builds of Qt 
that use the an ABI-compatible compiler & toolchain. I am opposing a change 

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering

More information about the Development mailing list