* [PATCH] Add noexcept to std::integral_constant members
@ 2017-12-01 15:09 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2017-12-01 15:09 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 319 bytes --]
C++14 added noexcept to the integral_constant member functions, and it
should always have been on the integer_sequence one.
* include/std/type_traits (integral_constant): Make member functions
noexcept (LWG 2346).
* include/std/utility (integer_sequence): Likewise.
Tested powerpc64le-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1687 bytes --]
commit 63ab060f8e958744dd06f09d7c639f45e66d09c0
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Dec 1 13:52:08 2017 +0000
Add noexcept to std::integral_constant members
* include/std/type_traits (integral_constant): Make member functions
noexcept (LWG 2346).
* include/std/utility (integer_sequence): Likewise.
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 723c137f5b9..1d639e452f3 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 e7386320e2a..da17928feee 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -321,7 +321,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); }
};
/// Alias template make_integer_sequence
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-12-01 15:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01 15:09 [PATCH] Add noexcept to std::integral_constant members Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).