[AMDGPU] Don't unify divergent exit nodes with `musttail` calls (#126395)
[llvm-project.git] / libcxx / test / std / time / time.cal / time.cal.ymwdlast / time.cal.ymwdlast.members / plus_minus_equal_year.pass.cpp
blob14c1f618ac885e4ee749596ba964e0668fab48c6
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 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // <chrono>
11 // class year_month_weekday_last;
13 // constexpr year_month_weekday_last& operator+=(const years& d) noexcept;
14 // constexpr year_month_weekday_last& operator-=(const years& d) noexcept;
16 #include <chrono>
17 #include <cassert>
18 #include <type_traits>
19 #include <utility>
21 #include "test_macros.h"
23 using year = std::chrono::year;
24 using month = std::chrono::month;
25 using weekday = std::chrono::weekday;
26 using weekday_last = std::chrono::weekday_last;
27 using year_month_weekday_last = std::chrono::year_month_weekday_last;
28 using years = std::chrono::years;
30 constexpr bool test() {
31 constexpr weekday Tuesday = std::chrono::Tuesday;
32 constexpr month January = std::chrono::January;
34 for (int i = 1000; i <= 1010; ++i) {
35 year_month_weekday_last ymwd(year{i}, January, weekday_last{Tuesday});
37 assert(static_cast<int>((ymwd += years{2}).year()) == i + 2);
38 assert(ymwd.month() == January);
39 assert(ymwd.weekday() == Tuesday);
41 assert(static_cast<int>((ymwd).year()) == i + 2);
42 assert(ymwd.month() == January);
43 assert(ymwd.weekday() == Tuesday);
45 assert(static_cast<int>((ymwd -= years{1}).year()) == i + 1);
46 assert(ymwd.month() == January);
47 assert(ymwd.weekday() == Tuesday);
49 assert(static_cast<int>((ymwd).year()) == i + 1);
50 assert(ymwd.month() == January);
51 assert(ymwd.weekday() == Tuesday);
54 return true;
57 int main(int, char**) {
58 ASSERT_NOEXCEPT(std::declval<year_month_weekday_last&>() += std::declval<years>());
59 ASSERT_NOEXCEPT(std::declval<year_month_weekday_last&>() -= std::declval<years>());
61 ASSERT_SAME_TYPE(
62 year_month_weekday_last&, decltype(std::declval<year_month_weekday_last&>() += std::declval<years>()));
63 ASSERT_SAME_TYPE(
64 year_month_weekday_last&, decltype(std::declval<year_month_weekday_last&>() -= std::declval<years>()));
66 test();
67 static_assert(test());
69 return 0;