3665. Is std::allocator_traits<Alloc>::rebind_alloc SFINAE-friendly?

Section: 20.2.9.2 [allocator.traits.types] Status: New Submitter: Jiang An Opened: 2022-01-24 Last modified: 2022-03-04

Priority: 3

View all other issues in [allocator.traits.types].

View all issues with New status.

Discussion:

20.2.9.2 [allocator.traits.types]/11 says that the instantiation of rebind_alloc is sometimes ill-formed, however, it's unclear such ill-formedness results in substitution failure or hard error. It seems that current implementations (libc++, libstd++, MSVC STL) give substitution errors, and we should reword 20.2.9.2 [allocator.traits.types]/11 with "Constraints:".

[2022-01-29; Daniel comments]

This issue has some overlap with LWG 3545 in regard to the question how we should handle the rebind member template of the pointer_traits primary template as specified by 20.2.3.2 [pointer.traits.types] p3. It would seem preferable to decide for the same approach in both cases.

[2022-03-04; Reflector poll]

Set priority to 3 after reflector poll. Probably NAD, since [allocator.requirements.general]/11 allows any allocator instantiation to fail with a hard error outside the immediate context, making it impossible to guarantee a SFINAE-friendly result. Also unclear what motivation there is for it being SFINAE friendly.

Proposed resolution: