]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/duration/requirements/noexcept.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / duration / requirements / noexcept.cc
CommitLineData
8d9254fc 1// Copyright (C) 2019-2020 Free Software Foundation, Inc.
5e9aed14
JW
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.
8
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.
13
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/>.
17
18// { dg-do compile { target c++11 } }
19
20// P0972R0 <chrono> zero(), min(), and max() should be noexcept
21
22#include <chrono>
23
24using namespace std;
25
26using vals = chrono::duration_values<short>;
27static_assert( noexcept(vals::zero()), "duration_values::zero()" );
28static_assert( noexcept(vals::min()), "duration_values::min()" );
29static_assert( noexcept(vals::max()), "duration_values::max()" );
30
31using dur1 = chrono::system_clock::duration;
32static_assert( noexcept(dur1::zero()), "duration::zero()" );
33static_assert( noexcept(dur1::min()), "duration::min()" );
34static_assert( noexcept(dur1::max()), "duration::max()" );
35
36using dur2 = chrono::duration<short, ratio<10>>;
37static_assert( noexcept(dur2::zero()), "duration::zero()" );
38static_assert( noexcept(dur2::min()), "duration::min()" );
39static_assert( noexcept(dur2::max()), "duration::max()" );