brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 068218f Raw
28 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710// TODO: Change to XFAIL once https://llvm.org/PR40995 is fixed11// UNSUPPORTED: availability-pmr-missing12 13// check that functions are marked [[nodiscard]]14 15// [[nodiscard]] std::pmr::memory_resource::allocate(size_t, size_t);16// [[nodiscard]] std::pmr::polymorphic_allocator<T>::allocate(size_t, size_t);17 18#include <memory_resource>19 20void f() {21  std::pmr::memory_resource* res = nullptr;22  res->allocate(0);    // expected-warning {{ignoring return value of function}}23  res->allocate(0, 1); // expected-warning {{ignoring return value of function}}24 25  std::pmr::polymorphic_allocator<int> poly;26  poly.allocate(0); // expected-warning {{ignoring return value of function}}27}28