]>
Commit | Line | Data |
---|---|---|
03d5044b PP |
1 | // { dg-options "-std=gnu++2a" } |
2 | // { dg-do compile { target c++2a } } | |
3 | ||
7adcbafe | 4 | // Copyright (C) 2020-2022 Free Software Foundation, Inc. |
03d5044b PP |
5 | // |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
9 | // Free Software Foundation; either version 3, or (at your option) | |
10 | // any later version. | |
11 | ||
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | ||
17 | // You should have received a copy of the GNU General Public License along | |
18 | // with this library; see the file COPYING3. If not see | |
19 | // <http://www.gnu.org/licenses/>. | |
20 | ||
21 | // Class template day [time.cal.month_day_last] | |
22 | ||
23 | #include <chrono> | |
24 | ||
25 | constexpr void | |
26 | constexpr_month_day_last() | |
27 | { | |
28 | using namespace std::chrono; | |
29 | using mdl = month_day_last; | |
30 | ||
31 | constexpr auto mdl0 = February / last; | |
32 | static_assert(mdl0.month() == February); | |
33 | ||
34 | constexpr auto mdl1 = month_day_last{month{3}}; | |
35 | static_assert(mdl1.month() == month{3}); | |
36 | ||
37 | static_assert( mdl{month{3}}.ok()); | |
38 | static_assert(!mdl{month{0}}.ok()); | |
39 | static_assert(!mdl{month{13}}.ok()); | |
40 | ||
41 | static_assert( (mdl{month{1}} == mdl{month{1}})); | |
42 | static_assert(!(mdl{month{2}} != mdl{month{2}})); | |
43 | static_assert(!(mdl{month{3}} < mdl{month{3}})); | |
44 | static_assert(!(mdl{month{4}} > mdl{month{4}})); | |
45 | static_assert( (mdl{month{5}} <= mdl{month{5}})); | |
46 | static_assert( (mdl{month{6}} >= mdl{month{6}})); | |
47 | static_assert( (mdl{month{10}} == mdl{month{10}})); | |
48 | static_assert( (mdl{month{9}} != mdl{month{10}})); | |
49 | static_assert( (mdl{month{8}} < mdl{month{10}})); | |
50 | static_assert( (mdl{month{11}} > mdl{month{10}})); | |
51 | static_assert( (mdl{month{10}} <= mdl{month{10}})); | |
52 | static_assert( (mdl{month{10}} >= mdl{month{10}})); | |
53 | ||
54 | static_assert( (mdl{month{1}} <=> mdl{month{1}}) | |
55 | == std::strong_ordering::equal); | |
56 | static_assert( (mdl{month{11}} <=> mdl{month{10}}) | |
57 | == std::strong_ordering::greater); | |
58 | static_assert( (mdl{month{8}} <=> mdl{month{10}}) | |
59 | == std::strong_ordering::less); | |
60 | ||
61 | static_assert(August/last == mdl{month{8}}); | |
62 | static_assert(8/last == mdl{month{8}}); | |
63 | static_assert(last/August == mdl{month{8}}); | |
64 | static_assert(last/8 == mdl{month{8}}); | |
65 | } |