Description
Describe the bug
According to [structure.specifications]/4, some uses of "Effects: Equivalent to" specifies "Constraints:" of the underlying function calls. I suppose that it only propagates "Constraints:" specified for standard library functions, not literal requires
or other substitution failures, and the implied "Constraints:" were specified by "Remarks:" in C++11~17 (in other words, essentially unchanged in C++20).
From a quick glance at WG21-N4901, I think the following functions have additional SFINAE constraints (and currently there're some defects in N4901):
- template overloads of
std::shared_ptr::operator=
- template overloads of
std::shared_ptr::reset
- template overloads of
std::weak_ptr::operator=
std::make_optional
std::make_any
- the template overload of
std::move_only_function::operator=
(Anything missing?)
Currently none of these functions is constrained in MSVC STL (except for std::move_only_function::operator=
, which is being implemented).
As all of these functions have the same "Constraints:" as the selected constructors, perhaps we can simply add enable_if_t<is_constructible_v<...>, int> = 0
to them.
I have submitted 2 related LWG issues:
- LWG-3627:
std::make_optional
overloads are inconsitently specified. IMO they should all be constrained. - LWG-3628:
uninitialized
algorithms and somestd::reduce
overloads are also specified by "Effects: Equivalent to", but I feel that they are misspecified and should not have additional SFINAE constraints.