libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

literals.pass.cpp (1215B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
     10 // UNSUPPORTED: clang-5, clang-6, clang-7
     11 // UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9, apple-clang-10
     12 
     13 // <chrono>
     14 // class day;
     15 
     16 // constexpr day operator""d(unsigned long long d) noexcept;
     17 
     18 #include <chrono>
     19 #include <type_traits>
     20 #include <cassert>
     21 
     22 #include "test_macros.h"
     23 
     24 int main()
     25 {
     26     {
     27     using namespace std::chrono;
     28     ASSERT_NOEXCEPT(               4d);
     29     ASSERT_SAME_TYPE(day, decltype(4d));
     30 
     31     static_assert( 7d == day(7), "");
     32     day d1 = 4d;
     33     assert (d1 == day(4));
     34 }
     35 
     36     {
     37     using namespace std::literals;
     38     ASSERT_NOEXCEPT(                            4d);
     39     ASSERT_SAME_TYPE(std::chrono::day, decltype(4d));
     40 
     41     static_assert( 7d == std::chrono::day(7), "");
     42 
     43     std::chrono::day d1 = 4d;
     44     assert (d1 == std::chrono::day(4));
     45     }
     46 
     47 }