STL icon indicating copy to clipboard operation
STL copied to clipboard

LWG-3627 Inconsistent specifications for `std::make_optional` overloads

Open StephanTLavavej opened this issue 1 month ago • 3 comments

LWG-3627 Inconsistent specifications for std::make_optional overloads

StephanTLavavej avatar Nov 13 '25 18:11 StephanTLavavej

I believe the resolution was speculatively implemented in #2607. https://github.com/microsoft/STL/blob/ab6dec6d85c90b272d219ba60da4478b169b72b4/stl/inc/optional#L983

However, in C++26 this overload is additionally constrained ([optional.specalg]/3), and thus it's unclear to me whether such wording change still introduces implicit SFINAE constraints.

frederick-vs-ja avatar Nov 14 '25 10:11 frederick-vs-ja

Thanks, then we just need to remove the comments.

I don't understand "Constraints: The call to make_optional does not use an explicit template-argument-list that begins with a type template-argument." at all. How is that even implementable? That sounds like a user restriction.

StephanTLavavej avatar Nov 15 '25 14:11 StephanTLavavej

Thanks, then we just need to remove the comments.

I don't understand "Constraints: The call to make_optional does not use an explicit template-argument-list that begins with a type template-argument." at all. How is that even implementable? That sounds like a user restriction.

With something like template<int = 0, class T>. The point is to make make_optional<T>(x) always go to one of the other two overloads.

timsong-cpp avatar Nov 17 '25 15:11 timsong-cpp