1 // Copyright (C) 2019-2024 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-do compile { target c++11 } }
20 // P0972R0 <chrono> zero(), min(), and max() should be noexcept
26 using vals
= chrono::duration_values
<short>;
27 static_assert( noexcept(vals::zero()), "duration_values::zero()" );
28 static_assert( noexcept(vals::min()), "duration_values::min()" );
29 static_assert( noexcept(vals::max()), "duration_values::max()" );
31 using dur1
= chrono::system_clock::duration
;
32 static_assert( noexcept(dur1::zero()), "duration::zero()" );
33 static_assert( noexcept(dur1::min()), "duration::min()" );
34 static_assert( noexcept(dur1::max()), "duration::max()" );
36 using dur2
= chrono::duration
<short, ratio
<10>>;
37 static_assert( noexcept(dur2::zero()), "duration::zero()" );
38 static_assert( noexcept(dur2::min()), "duration::min()" );
39 static_assert( noexcept(dur2::max()), "duration::max()" );