C++2a synchronisation inefficient in GCC 11

Ville Voutilainen ville.voutilainen@gmail.com
Fri Feb 26 23:58:01 GMT 2021


On Sat, 27 Feb 2021 at 01:53, Thiago Macieira <thiago.macieira@intel.com> wrote:
> Think about this scenario. Let's say GCC 12 declares to C++20 support to be
> non-experimental.
>
> Then someone writes a production tool that does:
>
> #if __cpp_lib_atomic_wait >= 201907L
>     a.wait(n);
> #else
>     fallback(a);
> #endif
>
> Should they also prevent people from compiling their code with GCC 11, which
> will define the macro and does support "-std=c++20"?

Yes, if there's an implementation bug in GCC 11 that renders the GCC
12 implementation incompatible.
This is not new.

> Is there a way to programmatically determine what level of the C++ Standard
> Library is officially supported so the requirement can be turned into a test?

No general one. Here we are talking about implementation bugs;
feature-testing macros are not
trying to cover those. And in the sunshine cases where we don't have
bugs or binary breaks,
defining the macros early is fine, so we're not going to postpone
defining them, in the hypothetical
event that someone might suggest that.


More information about the Libstdc++ mailing list