[libcxx][NFC] Make sequence containers slightly more SFINAE-friendly during CTAD.
Disable the constructors taking `(size_type, const value_type&, allocator_type)` if `allocator_type` is not a valid allocator. Otherwise, these constructors are considered when resolving e.g. `(int*, int*, NotAnAllocator())`, leading to a hard error during instantiation. A hard error makes the Standard's requirement to not consider deduction guides of the form `(Iterator, Iterator, BadAllocator)` during overload resolution essentially non-functional. The previous approach was to SFINAE away `allocator_traits`. This patch SFINAEs away the specific constructors instead, for consistency with `basic_string` -- see [LWG3076](wg21.link/lwg3076) which describes a very similar problem for strings (note, however, that unlike LWG3076, no valid constructor call is affected by the bad instantiation). Differential Revision: https://reviews.llvm.org/D114311
Loading
Please sign in to comment