Index: include/chrono =================================================================== --- include/chrono +++ include/chrono @@ -33,9 +33,9 @@ struct duration_values { public: - static constexpr Rep zero(); - static constexpr Rep max(); - static constexpr Rep min(); + static constexpr Rep zero(); // noexcept in C++20 + static constexpr Rep max(); // noexcept in C++20 + static constexpr Rep min(); // noexcept in C++20 }; // duration @@ -92,9 +92,9 @@ // special values - static constexpr duration zero(); - static constexpr duration min(); - static constexpr duration max(); + static constexpr duration zero(); // noexcept in C++20 + static constexpr duration min(); // noexcept in C++20 + static constexpr duration max(); // noexcept in C++20 }; typedef duration nanoseconds; @@ -134,8 +134,8 @@ // special values - static constexpr time_point min(); - static constexpr time_point max(); + static constexpr time_point min(); // noexcept in C++20 + static constexpr time_point max(); // noexcept in C++20 }; } // chrono @@ -924,9 +924,9 @@ struct _LIBCPP_TEMPLATE_VIS duration_values { public: - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);} - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();} - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT {return _Rep(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() _NOEXCEPT {return numeric_limits<_Rep>::max();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT {return numeric_limits<_Rep>::lowest();} }; #if _LIBCPP_STD_VER > 14 @@ -1081,9 +1081,9 @@ // special values - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values::zero());} - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values::min());} - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values::max());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() _NOEXCEPT {return duration(duration_values::zero());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() _NOEXCEPT {return duration(duration_values::min());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() _NOEXCEPT {return duration(duration_values::max());} }; typedef duration nanoseconds; @@ -1369,8 +1369,8 @@ // special values - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());} - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() _NOEXCEPT {return time_point(duration::min());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() _NOEXCEPT {return time_point(duration::max());} }; } // chrono Index: test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp =================================================================== --- test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp +++ test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp @@ -11,7 +11,7 @@ // duration -// static constexpr duration max(); +// static constexpr duration max(); // noexcept after C++17 #include #include @@ -23,6 +23,10 @@ template void test() { + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::max()); +#if TEST_STD_VER > 17 + ASSERT_NOEXCEPT( std::chrono::duration_values::max()); +#endif { typedef typename D::rep Rep; Rep max_rep = std::chrono::duration_values::max(); Index: test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp =================================================================== --- test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp +++ test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp @@ -11,7 +11,7 @@ // duration -// static constexpr duration min(); +// static constexpr duration min(); // noexcept after C++17 #include #include @@ -23,6 +23,10 @@ template void test() { + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::min()); +#if TEST_STD_VER > 17 + ASSERT_NOEXCEPT( std::chrono::duration_values::min()); +#endif { typedef typename D::rep Rep; Rep min_rep = std::chrono::duration_values::min(); Index: test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp =================================================================== --- test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp +++ test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp @@ -11,7 +11,7 @@ // duration -// static constexpr duration zero(); +// static constexpr duration zero(); // noexcept after C++17 #include #include @@ -22,6 +22,10 @@ template void test() { + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::zero()); +#if TEST_STD_VER > 17 + ASSERT_NOEXCEPT( std::chrono::duration_values::zero()); +#endif { typedef typename D::rep Rep; Rep zero_rep = std::chrono::duration_values::zero(); Index: test/std/utilities/time/time.point/time.point.special/max.pass.cpp =================================================================== --- test/std/utilities/time/time.point/time.point.special/max.pass.cpp +++ test/std/utilities/time/time.point/time.point.special/max.pass.cpp @@ -11,15 +11,21 @@ // time_point -// static constexpr time_point max(); +// static constexpr time_point max(); // noexcept after C++17 #include #include +#include "test_macros.h" + int main() { typedef std::chrono::system_clock Clock; typedef std::chrono::milliseconds Duration; typedef std::chrono::time_point TP; + LIBCPP_ASSERT_NOEXCEPT(TP::max()); +#if TEST_STD_VER > 17 + ASSERT_NOEXCEPT( TP::max()); +#endif assert(TP::max() == TP(Duration::max())); } Index: test/std/utilities/time/time.point/time.point.special/min.pass.cpp =================================================================== --- test/std/utilities/time/time.point/time.point.special/min.pass.cpp +++ test/std/utilities/time/time.point/time.point.special/min.pass.cpp @@ -11,15 +11,21 @@ // time_point -// static constexpr time_point min(); +// static constexpr time_point min(); // noexcept after C++17 #include #include +#include "test_macros.h" + int main() { typedef std::chrono::system_clock Clock; typedef std::chrono::milliseconds Duration; typedef std::chrono::time_point TP; + LIBCPP_ASSERT_NOEXCEPT(TP::max()); +#if TEST_STD_VER > 17 + ASSERT_NOEXCEPT( TP::max()); +#endif assert(TP::min() == TP(Duration::min())); } Index: test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp =================================================================== --- test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp +++ test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp @@ -9,7 +9,7 @@ // -// duration_values::max +// duration_values::max // noexcept after C++17 #include #include @@ -34,4 +34,13 @@ static_assert(std::chrono::duration_values::max() == std::numeric_limits::max(), ""); #endif + + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::max()); + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::max()); + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::max()); +#if TEST_STD_VER > 17 + ASSERT_NOEXCEPT(std::chrono::duration_values::max()); + ASSERT_NOEXCEPT(std::chrono::duration_values::max()); + ASSERT_NOEXCEPT(std::chrono::duration_values::max()); +#endif } Index: test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp =================================================================== --- test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp +++ test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp @@ -9,7 +9,7 @@ // -// duration_values::min +// duration_values::min // noexcept after C++17 #include #include @@ -34,4 +34,13 @@ static_assert(std::chrono::duration_values::min() == std::numeric_limits::lowest(), ""); #endif + + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::min()); + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::min()); + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::min()); +#if TEST_STD_VER > 17 + ASSERT_NOEXCEPT(std::chrono::duration_values::min()); + ASSERT_NOEXCEPT(std::chrono::duration_values::min()); + ASSERT_NOEXCEPT(std::chrono::duration_values::min()); +#endif } Index: test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp =================================================================== --- test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp +++ test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp @@ -9,7 +9,7 @@ // -// duration_values::zero +// duration_values::zero // noexcept after C++17 #include #include @@ -25,4 +25,11 @@ static_assert(std::chrono::duration_values::zero() == 0, ""); static_assert(std::chrono::duration_values::zero() == 0, ""); #endif + + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::zero()); + LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values::zero()); +#if TEST_STD_VER > 17 + ASSERT_NOEXCEPT(std::chrono::duration_values::zero()); + ASSERT_NOEXCEPT(std::chrono::duration_values::zero()); +#endif }