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 // duration
12 
13 // duration& operator*=(const rep& rhs);
14 
15 #include <chrono>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 #include "../../rep.h"
20 
21 #if TEST_STD_VER > 14
test_constexpr()22 constexpr bool test_constexpr()
23 {
24     std::chrono::seconds s(3);
25     s *= 5;
26     return s.count() == 15;
27 }
28 #endif
29 
main(int,char **)30 int main(int, char**)
31 {
32     {
33     std::chrono::nanoseconds ns(3);
34     ns *= 5;
35     assert(ns.count() == 15);
36     }
37 
38 #if TEST_STD_VER > 14
39     static_assert(test_constexpr(), "");
40 #endif
41 
42 #if TEST_STD_VER >= 11
43     { // This is PR#41130
44     std::chrono::nanoseconds d(5);
45     NotARep n;
46     d *= n;
47     assert(d.count() == 5);
48     }
49 #endif
50 
51   return 0;
52 }
53