1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // UNSUPPORTED: c++03, c++11, c++14
10
11 // check that functions are marked [[nodiscard]] as an extension in C++17
12
13 // [[nodiscard]] std::pmr::memory_resource::allocate(size_t, size_t);
14 // [[nodiscard]] std::pmr::polymorphic_allocator<T>::allocate(size_t, size_t);
15
16 #include <memory_resource>
17
f()18 void f() {
19 std::pmr::memory_resource* res = nullptr;
20 res->allocate(0); // expected-warning {{ignoring return value of function}}
21 res->allocate(0, 1); // expected-warning {{ignoring return value of function}}
22
23 std::pmr::polymorphic_allocator<int> poly;
24 poly.allocate(0); // expected-warning {{ignoring return value of function}}
25 }
26