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 // <chrono>
11 
12 // duration
13 
14 // static constexpr duration zero();
15 
16 #include <chrono>
17 #include <cassert>
18 
19 #include "../../rep.h"
20 
21 template <class D>
test()22 void test()
23 {
24     {
25     typedef typename D::rep Rep;
26     Rep zero_rep = std::chrono::duration_values<Rep>::zero();
27     assert(D::zero().count() == zero_rep);
28     }
29 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
30     {
31     typedef typename D::rep Rep;
32     constexpr Rep zero_rep = std::chrono::duration_values<Rep>::zero();
33     static_assert(D::zero().count() == zero_rep, "");
34     }
35 #endif
36 }
37 
main()38 int main()
39 {
40     test<std::chrono::duration<int> >();
41     test<std::chrono::duration<Rep> >();
42 }
43