[libcxx-commits] [libcxx] [libc++] Fix UB in <expected> related to "has value" flag (#68552) (PR #68733)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 10 11:44:19 PDT 2023


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 ebea9308379d3d06a2e495352b15dfb453e0f604 779aedda85828357f58b3eaf38fa1350ffa2d16f -- libcxx/test/std/utilities/expected/expected.expected/observers/has_value_clobber.pass.cpp
``````````

</details>

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

``````````diff
diff --git a/libcxx/test/std/utilities/expected/expected.expected/observers/has_value_clobber.pass.cpp b/libcxx/test/std/utilities/expected/expected.expected/observers/has_value_clobber.pass.cpp
index ef5499258b7f..fdfbb0041abd 100644
--- a/libcxx/test/std/utilities/expected/expected.expected/observers/has_value_clobber.pass.cpp
+++ b/libcxx/test/std/utilities/expected/expected.expected/observers/has_value_clobber.pass.cpp
@@ -18,9 +18,7 @@
 
 // See https://github.com/llvm/llvm-project/issues/68552
 void testClobberHasValue() {
-  static constexpr auto f1 = [] -> std::expected<std::optional<int>, long> {
-    return 0;
-  };
+  static constexpr auto f1 = [] -> std::expected<std::optional<int>, long> { return 0; };
 
   static constexpr auto f2 = [] -> std::expected<std::optional<int>, int> {
     return f1().transform_error([](auto) { return 0; });

``````````

</details>


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


More information about the libcxx-commits mailing list