C++ Logo

sg10

Advanced search

Re: [SG10] [isocpp-core] Feature-test macro for ADL calls with template arguments?

From: Marc Mutz <marc.mutz_at_[hidden]>
Date: Tue, 09 Jun 2020 09:15:31 +0200
On 2020-06-08 22:35, Ville Voutilainen via Core wrote:
> On Mon, 8 Jun 2020 at 23:30, Gabriel Dos Reis via SG10
[...]
>> Indeed, this sounds to be like an overkill application of feature test
>> macros, but…
>
> Well, this macro gives users with the use case I depicted some more
> choices:
> 1) use a work-around that is just.. ..ghastly
> 2) provide an ADL-only customization point if and only if it can be
> written without ghastliness
> 3) just provide a customization point that is not ADL-only
> 4) do (1) or (3) if (2) is not available

5) limit test code to platforms/compiler versions that actually
implement the feature

This is a variation of the example Ville talked about:
https://godbolt.org/z/DabS5M // cf. "Print using get()"

Both GCC and Clang trunks implement the feature, but while Clang is bold
enough to already assert conformance with C++20 via __cplusplus, GCC
isn't, showing how __cplusplus is way too coarse (if it wasn't, then
we'd not have feature test macros in the first place).

Might we systematically underestimate the need for feature test macros,
because test code isn't on the radar?

Thanks,
Marc

Received on 2020-06-09 02:18:44