[libcxx-commits] [libcxx] [libc++][optional] Applied `[[nodiscard]]` (PR #170045)

William Tran-Viet via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 1 05:16:52 PST 2025


================
@@ -231,8 +231,8 @@ constexpr void test_val_types() {
 constexpr void test_sfinae() {
   std::optional<NonConst> opt{};
   auto l = [](auto&& x) { return x.non_const(); };
-  opt.and_then(l);
-  std::move(opt).and_then(l);
+  (void)opt.and_then(l);
----------------
smallp-o-p wrote:

Nit, not really a 'must change':
```suggestion
  [[maybe_unused]] opt.and_then(l);
```

Ditto for every other instance. 


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


More information about the libcxx-commits mailing list