brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · ad1bce8 Raw
38 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8//9// Due to C++17 inline variables ASAN flags this test as containing an ODR10// violation because Clock::is_steady is defined in both the dylib and this TU.11// UNSUPPORTED: asan12 13// <chrono>14 15// high_resolution_clock16 17// check clock invariants18 19#include <chrono>20#include <type_traits>21 22#include "test_macros.h"23 24template <class T>25void test(const T &) {}26 27int main(int, char**)28{29    typedef std::chrono::high_resolution_clock C;30    static_assert((std::is_same<C::rep, C::duration::rep>::value), "");31    static_assert((std::is_same<C::period, C::duration::period>::value), "");32    static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");33    static_assert(C::is_steady || !C::is_steady, "");34    test(std::chrono::high_resolution_clock::is_steady);35 36  return 0;37}38