[Development] <version> (was: Re: C++20 @ Qt)

Marc Mutz marc.mutz at qt.io
Mon Nov 14 11:14:49 CET 2022

On 12.11.22 14:32, Giuseppe D'Angelo via Development wrote:
> I'm not sure if this has been explicitly discussed, but a prerequisite 
> for this scheme to work is that compiler vendors *do not* define library 
> feature macros inside <version> that you cannot use in the current C++ 
> version. In other words, having the proposed:
> #if __cpp_some_cpp23_feature
> # include <cpp23_feature>
> #endif
> is never going to blow up with some #error inside the included header 
> when compiling in pre-C++23 mode. I'm guessing that's always the case, 
> right?

I'm hoping that the vendors have learned from the SD-6 __has_include 
fiasco, and won't repeat it for C++23. So far, the CI results, as well 
as inspecting <version> in the three openly-visible implementations (MS 
STL, libc++, libstdc++) suggests that they did:

- https://github.com/llvm/llvm-project/blob/main/libcxx/include/version#L381
- https://github.com/microsoft/STL/blob/main/stl/inc/yvals_core.h#L1644

 From my pov, the risk is currently more on the C++17 side.


Marc Mutz <marc.mutz at qt.io>
Principal Software Engineer

The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany

Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B

More information about the Development mailing list