[libcxx-commits] [libcxx] [libc++] Fix constraints for `optional`'s constructors taking `in_place_t` and related `make_optional` overloads (PR #173467)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 30 23:09:13 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions ,cpp -- libcxx/include/optional libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp libcxx/test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp libcxx/test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/optional b/libcxx/include/optional
index 1a62d702b..3494acf8f 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -746,7 +746,7 @@ template <class _Tp, class _Up, class... _Args>
 inline constexpr bool __is_constructible_for_optional_initializer_list_v =
     is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>;
 
-#    if _LIBCPP_STD_VER >= 26
+#      if _LIBCPP_STD_VER >= 26
 template <class _Tp, class... _Args>
 inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Args...> = false;
 template <class _Tp, class _Arg>
@@ -755,7 +755,7 @@ inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Arg> =
 
 template <class _Tp, class _Up, class... _Args>
 inline constexpr bool __is_constructible_for_optional_initializer_list_v<_Tp&, _Up, _Args...> = false;
-#    endif
+#      endif
 
 template <class _Tp>
 struct __optional_iterator<_Tp&, enable_if_t<is_object_v<_Tp> && !__is_unbounded_array_v<_Tp> >> {

``````````

</details>


https://github.com/llvm/llvm-project/pull/173467


More information about the libcxx-commits mailing list