| 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 |
// <chrono> |
| 10 |
|
| 11 |
// treat_as_floating_point |
| 12 |
|
| 13 |
#include <chrono> |
| 14 |
#include <type_traits> |
| 15 |
|
| 16 |
#include "test_macros.h" |
| 17 |
|
| 18 |
template <class T> |
| 19 |
void |
| 20 |
test() |
| 21 |
{ |
| 22 |
static_assert((std::is_base_of<std::is_floating_point<T>, |
| 23 |
std::chrono::treat_as_floating_point<T> >::value), ""); |
| 24 |
#if TEST_STD_VER > 14 |
| 25 |
static_assert(std::is_floating_point<T>::value == |
| 26 |
std::chrono::treat_as_floating_point_v<T>, ""); |
| 27 |
#endif |
| 28 |
} |
| 29 |
|
| 30 |
struct A {}; |
| 31 |
|
| 32 |
int main(int, char**) |
| 33 |
{ |
| 34 |
test<int>(); |
| 35 |
test<unsigned>(); |
| 36 |
test<char>(); |
| 37 |
test<bool>(); |
| 38 |
test<float>(); |
| 39 |
test<double>(); |
| 40 |
test<long double>(); |
| 41 |
test<A>(); |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |