[libcxx-commits] [libcxx] [libc++][NFC] Reduce workaround in a `in_place_t` constructor of `optional` (PR #174306)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 9 04:59:39 PST 2026
================
@@ -895,11 +896,9 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default;
_LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {}
- template <
- class _InPlaceT,
- class... _Args,
- enable_if_t<_And<_IsSame<_InPlaceT, in_place_t>, __is_constructible_for_optional<_Tp, _Args...>>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_InPlaceT, _Args&&... __args)
+ // TODO(LLVM 23): Use _v instead of ::value.
----------------
frederick-vs-ja wrote:
The error messages are the following ([demo](https://godbolt.org/z/czW9PM9Yz), where test copied and correspondingly modified LLVM 20's `<optional>`):
```
<source>:1347:11: error: no matching member function for call to 'emplace'
1347 | w.inner.emplace();
| ~~~~~~~~^~~~~~~
<source>:764:60: note: candidate template ignored: requirement 'is_constructible_v<Wrapped::Inner>' was not satisfied [with _Args = <>]
764 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) {
```
https://github.com/llvm/llvm-project/pull/174306
More information about the libcxx-commits
mailing list