diff options
Diffstat (limited to 'libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp')
| -rw-r--r-- | libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp new file mode 100644 index 00000000000..92b701f8bc2 --- /dev/null +++ b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// <chrono> +// class year; + +// constexpr year operator""y(unsigned long long y) noexcept; + +#include <chrono> +#include <type_traits> +#include <cassert> + +#include "test_macros.h" + +int main() +{ + { + using namespace std::chrono; + ASSERT_NOEXCEPT(4y); + + static_assert( 2017y == year(2017), ""); + year y1 = 2018y; + assert (y1 == year(2018)); + } + + { + using namespace std::literals; + ASSERT_NOEXCEPT(4d); + + static_assert( 2017y == std::chrono::year(2017), ""); + + std::chrono::year y1 = 2020y; + assert (y1 == std::chrono::year(2020)); + } +} |

