Skip to content

Commit de00bf4

Browse files
committed
Fix the fix
1 parent 1fee6e0 commit de00bf4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libcxx/test/libcxx/containers/views/views.span/nodiscard.verify.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
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

1921
void 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}}

0 commit comments

Comments
 (0)