1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
13 // constexpr month& operator--() noexcept;
14 // constexpr month operator--(int) noexcept;
17 #include <type_traits>
20 #include "test_macros.h"
22 constexpr bool test() {
23 using month
= std::chrono::month
;
24 for (unsigned i
= 0; i
<= 15; ++i
) {
30 unsigned exp
= i
== 0 ? 11 : i
== 1 ? 12 : i
- 1;
33 assert(static_cast<unsigned>(m1
) == exp
);
35 for (unsigned i
= 0; i
<= 15; ++i
) {
42 unsigned exp
= i
== 0 ? 11 : i
== 1 ? 12 : i
- 1;
45 assert(static_cast<unsigned>(m1
) == exp
);
51 int main(int, char**) {
52 using month
= std::chrono::month
;
54 ASSERT_NOEXCEPT(--(std::declval
<month
&>()));
55 ASSERT_NOEXCEPT((std::declval
<month
&>())--);
57 ASSERT_SAME_TYPE(month
, decltype(std::declval
<month
&>()--));
58 ASSERT_SAME_TYPE(month
&, decltype(--std::declval
<month
&>()));
61 static_assert(test());