tree-optimization/116674 - vectorizable_simd_clone_call and re-analysis
[official-gcc.git] / libstdc++-v3 / testsuite / 20_util / duration / requirements / noexcept.cc
blobb18512e77383d1739381bfe1a52dc88eb8a9e842
1 // Copyright (C) 2019-2024 Free Software Foundation, Inc.
2 //
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)
7 // any later version.
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
22 #include <chrono>
24 using namespace std;
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()" );