47 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 day;12 13// constexpr day operator""d(unsigned long long d) 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( 4d);26 ASSERT_SAME_TYPE(day, decltype(4d));27 28 static_assert( 7d == day(7), "");29 day d1 = 4d;30 assert (d1 == day(4));31 }32 33 {34 using namespace std::literals;35 ASSERT_NOEXCEPT( 4d);36 ASSERT_SAME_TYPE(std::chrono::day, decltype(4d));37 38 static_assert( 7d == std::chrono::day(7), "");39 40 std::chrono::day d1 = 4d;41 assert (d1 == std::chrono::day(4));42 }43 44 45 return 0;46}47