On Fri, 15 Oct 2021 at 23:55, Barry Revzin <barry.revzin@gmail.com> wrote:

On Fri, Oct 15, 2021 at 5:27 PM Jonathan Wakely via SG10 <sg10@lists.isocpp.org> wrote:
I think the following papers should have had a feature test macro:

P0848 Conditionally Trivial Special Member Functions

P1330 Changing the active member of a union inside constexpr

I need a union in order to implement the std::variant changes in P2231 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?) 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.

I suppose given that not all compilers support them, it's not too late to go back and add the feature test macro? Although the compilers that do support it don't provide the macro - what do you think about the false negatives there?

I'm OK with degraded features because of that. It's better to not use the feature when I really could have done, than try to use it and get errors.

This is in the context of libstdc++, where I don't know who is going to use the code or what compiler they'll use, so by the time they get an error, it's too late for me to address it.