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 // UNSUPPORTED: libcpp-has-no-monotonic-clock
11
12 // Due to C++17 inline variables ASAN flags this test as containing an ODR
13 // violation because Clock::is_steady is defined in both the dylib and this TU.
14 // UNSUPPORTED: asan
15
16 // Starting with C++17, Clock::is_steady is inlined (but not before LLVM-3.9!),
17 // but before C++17 it requires the symbol to be present in the dylib, which
18 // is only shipped starting with macosx10.9.
19 // XFAIL: with_system_cxx_lib=macosx10.7 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
20 // XFAIL: with_system_cxx_lib=macosx10.8 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
21
22 // <chrono>
23
24 // steady_clock
25
26 // check clock invariants
27
28 #include <chrono>
29
30 template <class T>
test(const T &)31 void test(const T &) {}
32
main()33 int main()
34 {
35 typedef std::chrono::steady_clock C;
36 static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
37 static_assert((std::is_same<C::period, C::duration::period>::value), "");
38 static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
39 static_assert(C::is_steady, "");
40 test(std::chrono::steady_clock::is_steady);
41 }
42