brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1009 B · 8d597cc Raw
44 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8// UNSUPPORTED: c++03, c++11, c++14, c++179 10// <chrono>11// class year;12 13// constexpr year operator""y(unsigned long long y) noexcept;14 15#include <chrono>16#include <type_traits>17#include <cassert>18 19#include "test_macros.h"20 21int main(int, char**)22{23    {24    using namespace std::chrono;25    ASSERT_NOEXCEPT(4y);26 27    static_assert( 2017y == year(2017), "");28    year y1 = 2018y;29    assert (y1 == year(2018));30    }31 32    {33    using namespace std::literals;34    ASSERT_NOEXCEPT(4d);35 36    static_assert( 2017y == std::chrono::year(2017), "");37 38    std::chrono::year y1 = 2020y;39    assert (y1 == std::chrono::year(2020));40    }41 42  return 0;43}44