[libcxx-commits] [libcxx] [libc++][span] Mark functions as `[[nodiscard]]` (PR #168033)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 17 03:34:43 PST 2025
================
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++20
+
+// <span>
+
+// Check that functions are marked [[nodiscard]]
+
+#include <array>
+#include <span>
+#include <vector>
+
+#include "test_macros.h"
+
+void test() {
+ { // Test with a static extent
+ std::array arr{94, 92};
+ std::span sp{arr};
----------------
H-G-Hristov wrote:
I replaced all values with 0, which I think looks strange but handles the request. I believe this resolves it.
https://github.com/llvm/llvm-project/pull/168033
More information about the libcxx-commits
mailing list