[libcxx-commits] [libcxx] [libcxx] P0718R2: Implementation of std::atomic<shared_ptr<T>> and std::atomic<weak_ptr<T>> (PR #194215)

Vladislav Semykin via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 1 05:37:57 PDT 2026


================
@@ -31,6 +32,26 @@ void test() {
     // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
     atRef.load();
   }
+
+  {
+    std::atomic<std::shared_ptr<int>> asp;
+
+    // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+    asp.is_lock_free();
+
+    // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+    asp.load();
+  }
+
+  {
+    std::atomic<std::weak_ptr<int>> awp;
+
+    // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+    awp.is_lock_free();
+
+    // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+    awp.load();
+  }
----------------
ViNN280801 wrote:

Done. Thank you!

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


More information about the libcxx-commits mailing list