• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // constexpr duration operator++(int);  // constexpr in C++17
15 
16 #include <chrono>
17 #include <cassert>
18 
19 #include "test_macros.h"
20 
21 #if TEST_STD_VER > 14
test_constexpr()22 constexpr bool test_constexpr()
23 {
24     std::chrono::hours h1(3);
25     std::chrono::hours h2 = h1++;
26     return h1.count() == 4 && h2.count() == 3;
27 }
28 #endif
29 
main()30 int main()
31 {
32     {
33     std::chrono::hours h1(3);
34     std::chrono::hours h2 = h1++;
35     assert(h1.count() == 4);
36     assert(h2.count() == 3);
37     }
38 
39 #if TEST_STD_VER > 14
40     static_assert(test_constexpr(), "");
41 #endif
42 }
43