Skip to content

Commit b88cad5

Browse files
committed
added missing test cases
1 parent 2e14fa1 commit b88cad5

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

libcxx/test/libcxx/memory/nodiscard.verify.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,31 @@
99
// check that functions are marked [[nodiscard]] as an extension in C++17
1010

1111
// [[nodiscard]] std::make_unique(Args&&...);
12-
// [[nodiscard]] std::make_shared(Args&&...);
13-
//
1412
// [[nodiscard]] std::make_unique(size_t);
15-
// [[nodiscard]] std::make_shared(size_t);
16-
//
1713
// [[nodiscard]] std::make_unique_for_overwrite();
14+
// [[nodiscard]] std::make_unique_for_overwrite(size_t);
15+
16+
// [[nodiscard]] std::make_shared(Args&&...);
17+
// [[nodiscard]] std::make_shared(size_t);
1818
// [[nodiscard]] std::make_shared_for_overwrite();
19+
// [[nodiscard]] std::make_shared_for_overwrite(size_t);
20+
// [[nodiscard]] std::make_shared(size_t, const remove_extent_t<_Tp>&);
21+
// [[nodiscard]] std::make_shared(const remove_extent_t<_Tp>&);
1922

2023
#include <memory>
2124

2225
void f() {
2326

2427
std::make_unique<int>(1); // expected-warning {{ignoring return value of function}}
25-
std::make_shared<int>(1); // expected-warning {{ignoring return value of function}}
26-
2728
std::make_unique<int[]>(5); // expected-warning {{ignoring return value of function}}
28-
std::make_shared<int[]>(5); // expected-warning {{ignoring return value of function}}
29-
3029
std::make_unique_for_overwrite<int>(); // expected-warning {{ignoring return value of function}}
30+
std::make_unique_for_overwrite<int[]>(5); // expected-warning {{ignoring return value of function}}
31+
32+
std::make_shared<int>(1); // expected-warning {{ignoring return value of function}}
33+
std::make_shared<int[]>(5); // expected-warning {{ignoring return value of function}}
3134
std::make_shared_for_overwrite<int>(); // expected-warning {{ignoring return value of function}}
35+
std::make_shared_for_overwrite<int[]>(5); // expected-warning {{ignoring return value of function}}
36+
std::make_shared<int[]>(5, 1); // expected-warning {{ignoring return value of function}}
37+
std::make_shared<int[]>(1); // expected-warning {{ignoring return value of function}}
3238

3339
}

0 commit comments

Comments
 (0)