blob: 7dcf002259bc9ce1731a1378c7709812786f8b57 [file] [log] [blame]
Howard Hinnantc52f43e2010-08-22 00:59:46 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantc52f43e2010-08-22 00:59:46 +00007//
8//===----------------------------------------------------------------------===//
9
10// <chrono>
11
12// duration
13
14// duration& operator%=(const rep& rhs)
15
16#include <chrono>
17#include <cassert>
18
Marshall Clow3df90c92017-01-04 23:03:24 +000019#include "test_macros.h"
20
21#if TEST_STD_VER > 14
22constexpr bool test_constexpr()
23{
24 std::chrono::seconds s(11);
25 s %= 3;
26 return s.count() == 2;
27}
28#endif
29
Howard Hinnantc52f43e2010-08-22 00:59:46 +000030int main()
31{
Marshall Clow3df90c92017-01-04 23:03:24 +000032 {
Howard Hinnantc52f43e2010-08-22 00:59:46 +000033 std::chrono::microseconds us(11);
34 us %= 3;
35 assert(us.count() == 2);
Marshall Clow3df90c92017-01-04 23:03:24 +000036 }
Stephan T. Lavavej51eb1be2017-01-07 01:12:15 +000037
Marshall Clow3df90c92017-01-04 23:03:24 +000038#if TEST_STD_VER > 14
39 static_assert(test_constexpr(), "");
40#endif
Howard Hinnantc52f43e2010-08-22 00:59:46 +000041}