[libcxx-commits] [libcxx] [libc++][expected] Applied `[[nodiscard]]` (PR #170245)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 1 21:40:16 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,h -- libcxx/test/libcxx/utilities/expected/nodiscard.verify.cpp libcxx/include/__expected/bad_expected_access.h libcxx/include/__expected/expected.h libcxx/include/__expected/unexpected.h libcxx/test/libcxx/utilities/expected/expected.expected/and_then.mandates.verify.cpp libcxx/test/libcxx/utilities/expected/expected.expected/error_or.mandates.verify.cpp libcxx/test/libcxx/utilities/expected/expected.expected/or_else.mandates.verify.cpp libcxx/test/libcxx/utilities/expected/expected.expected/transform_error.mandates.verify.cpp libcxx/test/libcxx/utilities/expected/expected.expected/value_or.mandates.verify.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/test/libcxx/utilities/expected/expected.expected/value_or.mandates.verify.cpp b/libcxx/test/libcxx/utilities/expected/expected.expected/value_or.mandates.verify.cpp
index 0f19b39ec..470cd158e 100644
--- a/libcxx/test/libcxx/utilities/expected/expected.expected/value_or.mandates.verify.cpp
+++ b/libcxx/test/libcxx/utilities/expected/expected.expected/value_or.mandates.verify.cpp
@@ -36,7 +36,8 @@ void test() {
   // !is_copy_constructible_v<T>,
   {
     const std::expected<NonCopyable, int> f1{5};
-    (void)f1.value_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<NonCopyable, int>::value_or<int>' requested here}}
+    (void)f1.value_or(
+        5); // expected-note{{in instantiation of function template specialization 'std::expected<NonCopyable, int>::value_or<int>' requested here}}
     // expected-error-re@*:* {{static assertion failed {{.*}}value_type has to be copy constructible}}
   }
 
@@ -44,7 +45,8 @@ void test() {
   // !is_convertible_v<U, T>
   {
     const std::expected<NotConvertibleFromInt, int> f1{std::in_place};
-    (void)f1.value_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<NotConvertibleFromInt, int>::value_or<int>' requested here}}
+    (void)f1.value_or(
+        5); // expected-note{{in instantiation of function template specialization 'std::expected<NotConvertibleFromInt, int>::value_or<int>' requested here}}
     //expected-error-re@*:* {{static assertion failed {{.*}}argument has to be convertible to value_type}}
   }
 
@@ -52,7 +54,8 @@ void test() {
   // !is_move_constructible_v<T>,
   {
     std::expected<NonMovable, int> f1{5};
-    (void)std::move(f1).value_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<NonMovable, int>::value_or<int>' requested here}}
+    (void)std::move(f1).value_or(
+        5); // expected-note{{in instantiation of function template specialization 'std::expected<NonMovable, int>::value_or<int>' requested here}}
     //expected-error-re@*:* {{static assertion failed {{.*}}value_type has to be move constructible}}
   }
 
@@ -60,7 +63,8 @@ void test() {
   // !is_convertible_v<U, T>
   {
     std::expected<NotConvertibleFromInt, int> f1{std::in_place};
-    (void)std::move(f1).value_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<NotConvertibleFromInt, int>::value_or<int>' requested here}}
+    (void)std::move(f1).value_or(
+        5); // expected-note{{in instantiation of function template specialization 'std::expected<NotConvertibleFromInt, int>::value_or<int>' requested here}}
     //expected-error-re@*:* {{static assertion failed {{.*}}argument has to be convertible to value_type}}
   }
 }

``````````

</details>


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


More information about the libcxx-commits mailing list