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 // <chrono>
14
15 // system_clock
16
17 // check clock invariants
18
19 #include <chrono>
20
21 #include "test_macros.h"
22
23 template <class T>
test(const T &)24 void test(const T &) {}
25
main(int,char **)26 int main(int, char**)
27 {
28 typedef std::chrono::system_clock C;
29 static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
30 static_assert((std::is_same<C::period, C::duration::period>::value), "");
31 static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
32 static_assert((std::is_same<C::time_point::clock, C>::value), "");
33 static_assert((C::is_steady || !C::is_steady), "");
34 test(std::chrono::system_clock::is_steady);
35
36 return 0;
37 }
38