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