This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

### 3393. Missing/incorrect feature test macro for coroutines

Section: 17.3.2 [version.syn] Status: C++20 Submitter: Barry Revzin Opened: 2020-01-25 Last modified: 2021-02-25

Priority: 0

View other active issues in [version.syn].

View all other issues in [version.syn].

View all issues with C++20 status.

Discussion:

We have a policy, established in P1353 (and needing to be added to SD-6):

In some cases a feature requires two macros, one for the language and one for the library. For example, the library does not want to define its three-way comparison operations unless the compiler supports the feature.

For end-users, it is suggested that they test only the library macro, as that will only be true if the language macro is also true. As a result, the language macros contain "impl" to distinguish them from the more general version that is expected to be set by the library. That paper added two papers of macros: one for `<=>` and one for destroying `delete`. We have a third such example in coroutines: there is library machinery that needs to be provided only when the compiler has language support for it, and the end user should just check the library macro.

Previous resolution [SUPERSEDED]:

> This wording is relative to N4849.

> 1. Modify 15.11 [cpp.predefined], Table [tab:cpp.predefined.ft], as indicated:

>    > Table 18: Feature-test macros [tab:cpp.predefined.ft]
>    > Macro name | Value
>    > --- | ---
>    > `[…]`
>    > `__cpp_impl_coroutines` | `201902L`
>    > `[…]`

> 2. Modify 17.3.2 [version.syn], header `<version>` synopsis, as indicated:

>    >     […]
>    >     #define __cpp_lib_constexpr_vector    201907L // also in <vector>
>    >     #define __cpp_lib_coroutines          201902L // also in <coroutine>
>    >     #define __cpp_lib_destroying_delete   201806L // also in <new>
>    >     […]

[2020-02-11, Prague]

LWG observed that the naming suggestion didn't follow naming conventions of SG-10 because of the plural form `corountines`. The submitter agreed with that complaint, so the revised wording uses now the singular form.

[2020-02 Moved to Immediate on Tuesday in Prague.]

Proposed resolution:

This wording is relative to N4849.

1. Modify 15.11 [cpp.predefined], Table [tab:cpp.predefined.ft], as indicated:

   > Table 18: Feature-test macros [tab:cpp.predefined.ft]
   > Macro name | Value
   > --- | ---
   > `[…]`
   > `__cpp_impl_coroutines` | `201902L`
   > `[…]`

2. Modify 17.3.2 [version.syn], header `<version>` synopsis, as indicated:

   >     […]
   >     #define __cpp_lib_constexpr_vector    201907L // also in <vector>
   >     #define __cpp_lib_coroutine           201902L // also in <coroutine>
   >     #define __cpp_lib_destroying_delete   201806L // also in <new>
   >     […]