brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1016 B · 06c9855 Raw
53 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <chrono>10 11// duration12 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 > 1422constexpr bool test_constexpr()23{24    std::chrono::seconds s(3);25    s *= 5;26    return s.count() == 15;27}28#endif29 30int 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 > 1439    static_assert(test_constexpr(), "");40#endif41 42#if TEST_STD_VER >= 1143    { // This is PR#4113044    std::chrono::nanoseconds d(5);45    NotARep n;46    d *= n;47    assert(d.count() == 5);48    }49#endif50 51  return 0;52}53