[llvm-gsymutil] Disable test macho-gsym-merged-callsites-dsym (#119957)
[llvm-project.git] / libcxx / test / std / time / time.duration / time.duration.nonmember / op_divide_rep.pass.cpp
blob8b623aabe9eec65aba577d5b054886ca987b82fc
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 //===----------------------------------------------------------------------===//
9 // <chrono>
11 // duration
13 // template <class Rep1, class Period, class Rep2>
14 // constexpr
15 // duration<typename common_type<Rep1, Rep2>::type, Period>
16 // operator/(const duration<Rep1, Period>& d, const Rep2& s);
18 #include <chrono>
19 #include <cassert>
21 #include "test_macros.h"
22 #include "../../rep.h"
24 int main(int, char**)
27 typedef std::chrono::nanoseconds Dur;
28 Dur ns(15);
29 ASSERT_SAME_TYPE(Dur, decltype(ns / 5));
30 ns = ns / 5;
31 assert(ns.count() == 3);
33 #if TEST_STD_VER >= 11
35 constexpr std::chrono::nanoseconds ns(15);
36 constexpr std::chrono::nanoseconds ns2 = ns / 5;
37 static_assert(ns2.count() == 3, "");
39 #endif
41 #if TEST_STD_VER >= 11
42 { // This is PR#41130
43 typedef std::chrono::nanoseconds Duration;
44 Duration d(5);
45 NotARep n;
46 ASSERT_SAME_TYPE(Duration, decltype(d / n));
47 d = d / n;
48 assert(d.count() == 5);
50 #endif
52 return 0;