]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
Vendor import of libc++ trunk r302418:
[FreeBSD/FreeBSD.git] / test / std / utilities / time / time.clock / time.clock.hires / consistency.pass.cpp
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 //
10 // Due to C++17 inline variables ASAN flags this test as containing an ODR
11 // violation because Clock::is_steady is defined in both the dylib and this TU.
12 // UNSUPPORTED: asan
13
14 // Starting with C++17, Clock::is_steady is inlined (but not before LLVM-3.9!),
15 // but before C++17 it requires the symbol to be present in the dylib.
16 // XFAIL: availability=macosx10.7 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
17 // XFAIL: availability=macosx10.8 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
18
19 // <chrono>
20
21 // high_resolution_clock
22
23 // check clock invariants
24
25 #include <chrono>
26
27 template <class _Tp>
28 void test(const _Tp &) {}
29
30 int main()
31 {
32     typedef std::chrono::high_resolution_clock C;
33     static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
34     static_assert((std::is_same<C::period, C::duration::period>::value), "");
35     static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
36     static_assert(C::is_steady || !C::is_steady, "");
37     test(std::chrono::high_resolution_clock::is_steady);
38 }