From 526e9a2a50b2c25f1ce02270a8e333d78fcf4372 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 1 Dec 2017 17:12:18 +0000 Subject: [PATCH] Add noexcept to std::integral_constant members Backport from mainline 2017-12-01 Jonathan Wakely * include/std/type_traits (integral_constant): Make member functions noexcept (LWG 2346). * include/std/utility (integer_sequence): Likewise. From-SVN: r255328 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/std/type_traits | 4 ++-- libstdc++-v3/include/std/utility | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6289a2c113f..f51b81a5dab 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2017-12-01 Jonathan Wakely + Backport from mainline + 2017-12-01 Jonathan Wakely + + * include/std/type_traits (integral_constant): Make member functions + noexcept (LWG 2346). + * include/std/utility (integer_sequence): Likewise. + Backport from mainline 2017-11-16 Jonathan Wakely diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index e34529d8be5..098685739b2 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -71,12 +71,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static constexpr _Tp value = __v; typedef _Tp value_type; typedef integral_constant<_Tp, __v> type; - constexpr operator value_type() const { return value; } + constexpr operator value_type() const noexcept { return value; } #if __cplusplus > 201103L #define __cpp_lib_integral_constant_callable 201304 - constexpr value_type operator()() const { return value; } + constexpr value_type operator()() const noexcept { return value; } #endif }; diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index 1d9b8eb4287..978acb747e9 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -323,7 +323,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct integer_sequence { typedef _Tp value_type; - static constexpr size_t size() { return sizeof...(_Idx); } + static constexpr size_t size() noexcept { return sizeof...(_Idx); } }; template