|
9 | 9 | // check that functions are marked [[nodiscard]] as an extension in C++17 |
10 | 10 |
|
11 | 11 | // [[nodiscard]] std::make_unique(Args&&...); |
12 | | -// [[nodiscard]] std::make_shared(Args&&...); |
13 | | -// |
14 | 12 | // [[nodiscard]] std::make_unique(size_t); |
15 | | -// [[nodiscard]] std::make_shared(size_t); |
16 | | -// |
17 | 13 | // [[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); |
18 | 18 | // [[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>&); |
19 | 22 |
|
20 | 23 | #include <memory> |
21 | 24 |
|
22 | 25 | void f() { |
23 | 26 |
|
24 | 27 | 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 | | - |
27 | 28 | 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 | | - |
30 | 29 | 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}} |
31 | 34 | 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}} |
32 | 38 |
|
33 | 39 | } |
0 commit comments