C++ Logo


Advanced search

Re: [SG10] Missing feature test macros for C++20 core papers

From: Richard Smith <richardsmith_at_[hidden]>
Date: Thu, 21 Oct 2021 17:38:28 -0700
On Fri, Oct 15, 2021 at 3:27 PM Jonathan Wakely via SG10 <
sg10_at_[hidden]> wrote:

> I think the following papers should have had a feature test macro:
> P0848
> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0848r3.html>
> Conditionally Trivial Special Member Functions

I think we should bump __cpp_concepts for this. This was merged by the
2019-07 meeting, but unfortunately we're already using 201907L for the
state without this change, and compilers have shipped concepts support
without this change with that value for __cpp_concepts, so maybe we could
bump __cpp_concepts to some later date (201908L?) for this instead?

P1330 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1330r0.pdf>
> Changing the active member of a union inside constexpr

It would have been nice for the bump of __cpp_constexpr to 201907L to cover
this too. Too late now. Maybe we could bump this one to 201908L too?

Or maybe we could bump both macros to 202002L to mean "the complete set of
proposals in this area that were in C++20", and sweep up the various other
minor proposals affecting these areas into the new value? (Eg, constexpr
virtual function calls, constexpr dynamic_cast and typeid, the various NB
comments that changed the concepts rules.)

I need a union in order to implement the std::variant changes in P2231
> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2231r1.html>
> and a conditionally trivial destructor makes it easier. In order to define
> the __cpp_lib_constexpr_variant macro correctly I need to know if the union
> usage is actually going to work, but there's no macro for P1330, so I can't
> tell.
> A macro for constexpr destructors (P0784R7
> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0784r7.html>?)
> might have been nice too, because if the compiler doesn't support it then
> you get an error for even trying to declare a destructor constexpr. Without
> a feature test macro there's no reliable way to try to use the feature.
> If all the compilers I need to support already implemented those features,
> I wouldn't care, but they don't.
> https://godbolt.org/z/qG6d7TxhE
> --
> SG10 mailing list
> SG10_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg10

Received on 2021-10-21 19:38:43