[libcxx-commits] [libcxx] [libc++][map] Applied `[[nodiscard]]` (PR #169971)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 5 02:54:20 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}}
----------------
frederick-vs-ja wrote:
Also, the filename `multimap.nodiscard.verify copy.cpp` looks very weird. It should be renamed to `multimap.nodiscard.verify.cpp`.
https://github.com/llvm/llvm-project/pull/169971
More information about the libcxx-commits
mailing list