[libcxx-commits] [libcxx] [libc++][memory] Applied `[[nodiscard]]` to more functions (PR #172131)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 23 01:56:13 PST 2025
================
@@ -31,12 +38,28 @@ void test_allocator_traits() {
}
void test_allocator() {
- std::allocator<int> allocator;
- allocator.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-#if TEST_STD_VER <= 17
- allocator.allocate(1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-#endif
+ [[maybe_unused]] std::allocator<int> allocator;
----------------
philnik777 wrote:
The `[[maybe_unused]]` seems rather fishy. Why is it required?
https://github.com/llvm/llvm-project/pull/172131
More information about the libcxx-commits
mailing list