[libcxx-commits] [libcxx] [libc++][map] Applied `[[nodiscard]]` (PR #169971)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 5 23:21:37 PST 2025
================
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03
+
+// Check that functions are marked [[nodiscard]]
+
+#include <map>
+
+void test() {
+ std::multimap<int, int> multimap;
+ multimap.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
----------------
H-G-Hristov wrote:
Similar to the pre-existing tests for `flat_{set|map}`, etc. I split the test file in two for each type. That's why this is hanging alone. I intend to do the `multi{set|map}` after merging this immediately to reduce review comments on potentially reoccurring issues.
https://github.com/llvm/llvm-project/pull/169971
More information about the libcxx-commits
mailing list