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 // Check that format functions are marked [[nodiscard]] as a conforming extension
10
11 // UNSUPPORTED: c++03, c++11, c++14, c++17
12 // UNSUPPORTED: no-filesystem, no-localization, no-tzdb
13
14 // XFAIL: libcpp-has-no-incomplete-tzdb
15 // XFAIL: availability-tzdb-missing
16
17 // <chrono>
18
19 #include <chrono>
20
21 #include "test_macros.h"
22
test()23 void test() {
24 std::chrono::tzdb_list& list = std::chrono::get_tzdb_list();
25 list.front(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
26 list.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
27 list.end(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
28 list.cbegin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
29 list.cend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
30
31 namespace crno = std::chrono;
32 crno::get_tzdb_list(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
33 crno::get_tzdb(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
34 crno::remote_version(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
35 }
36