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
10
11 // We don't control the implementation of the stdlib.h functions on windows
12 // UNSUPPORTED: windows
13
14 // check that <cstdlib> functions are marked [[nodiscard]]
15
16 #include <cmath>
17 #include "test_macros.h"
18
test()19 void test() {
20 std::abs(0l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
21 std::abs(0ll); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
22 std::abs(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
23 std::abs(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
24 std::abs(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
25 }
26