File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
libcxx/test/libcxx/containers/views/views.span Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1212
1313// Check that functions are marked [[nodiscard]]
1414
15+ #include < array>
1516#include < span>
17+ #include < vector>
1618
1719#include " test_macros.h"
1820
1921void test () {
2022 { // Test with a static extent
21- std::span<int , 2 > sp;
23+ std::array<int , 2 > arr{94 , 82 };
24+ std::span<int , 2 > sp{arr};
2225
2326 sp.first <1 >(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
2427 sp.last <1 >(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -46,7 +49,8 @@ void test() {
4649 std::as_writable_bytes (sp);
4750 }
4851 { // Test with a dynamic extent
49- std::span<int > sp;
52+ std::vector vec{94 , 82 };
53+ std::span<int > sp{vec};
5054
5155 sp.first <1 >(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5256 sp.last <1 >(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
You can’t perform that action at this time.
0 commit comments