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

3635. Add __cpp_lib_deduction_guides to feature test macros

Section: 17.3.2 [version.syn] Status: NAD Submitter: Konstantin Varlamov Opened: 2021-11-09 Last modified: 2024-06-24

Priority: 3

View all other issues in [version.syn].

View all issues with NAD status.

Discussion:

P0433R2, the proposal for adding deduction guides to the standard library, contained a recommendation to use __cpp_lib_deduction_guides as a feature test macro. However, it appears that this feature test macro has been accidentally omitted from the Standard when the paper was applied and probably needs to be added back.

Previous resolution [SUPERSEDED]:

This wording is relative to N4901.

  1. Modify 17.3.2 [version.syn] as indicated:

    […]
    #define __cpp_lib_coroutine          201902L  // also in <coroutine>
    #define __cpp_lib_deduction_guides   201703L
      // also in <deque>, <forward_list>, <list>, <map>, <queue>, <set>, <stack>,
      // <unordered_map>, <unordered_set>, <vector>
    #define __cpp_lib_destroying_delete  201806L  // also in <new>
    […]
    

[2021-11-16; Konstantin Varlamov comments and improves wording]

One potential topic of discussion is whether the new feature test macro needs to be defined in every library header that contains an explicit deduction guide. While this would be consistent with the current approach, no other macro is associated with such a large set of headers (20 headers in total, whereas the current record-holder is __cpp_lib_nonmember_container_access with 12 headers). For this reason, it should be considered whether perhaps the new macro should only be defined in <version> (which would, however, make it an outlier). The proposed wording currently contains an exhaustive list (note that the deduction guides for <mutex> were removed by LWG 2981(i)).

[2022-01-30; Reflector poll]

Set priority to 3 after reflector poll. Several votes for NAD as it's too late to be useful, and code which needs to be portable to pre-CTAD compilers can just not use CTAD.

[2023-04-21; Reflector poll for 'Tentatively NAD']

"We keep changing the deduction guides, and different libraries might be conformant in some headers and not others. The status cannot be represented by a single number."

[St. Louis 2024-06-24 Status changed: Tentatively NAD → NAD.]

Proposed resolution:

This wording is relative to N4901.

  1. Modify 17.3.2 [version.syn] as indicated:

    […]
    #define __cpp_lib_coroutine          201902L  // also in <coroutine>
    #define __cpp_lib_deduction_guides   201703L
      // also in <array>, <deque>, <forward_list>, <functional>, <list>, <map>,
      // <memory>, <optional>, <queue>, <regex>, <scoped_allocator>, <set>, <stack>,
      // <string>, <tuple>, <unordered_map>, <unordered_set>, <utility>, <valarray>,
      // <vector>
    #define __cpp_lib_destroying_delete  201806L  // also in <new>
    […]