[libcxx-commits] [libcxx] [libc++][memory_resource] Applied `[[nodiscard]]` (PR #172134)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 12 00:56:42 PST 2026


================
@@ -173,11 +173,13 @@ class _LIBCPP_AVAILABILITY_PMR polymorphic_allocator {
     __p->~_Tp();
   }
 
-  _LIBCPP_HIDE_FROM_ABI polymorphic_allocator select_on_container_copy_construction() const noexcept {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI polymorphic_allocator select_on_container_copy_construction() const noexcept {
     return polymorphic_allocator();
   }
 
-  [[__gnu__::__returns_nonnull__]] _LIBCPP_HIDE_FROM_ABI memory_resource* resource() const noexcept { return __res_; }
+  [[nodiscard]] [[__gnu__::__returns_nonnull__]] _LIBCPP_HIDE_FROM_ABI memory_resource* resource() const noexcept {
----------------
philnik777 wrote:

```suggestion
  [[nodiscard, __gnu__::__returns_nonnull__]] _LIBCPP_HIDE_FROM_ABI memory_resource* resource() const noexcept {
```

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


More information about the libcxx-commits mailing list