The standard doesn't say these are noexcept, but they can be.

        * include/bits/range_access.h (size, empty, data): Add conditional
        noexcept to generic overloads.

Tested powerpc64le-linux, committed to trunk.


commit 9348811e74851f9ce6594cbe1b98a855193867dc
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Wed Nov 15 17:38:28 2017 +0000

    Add noexcept to generic std::size, std::empty and std::data
    
            * include/bits/range_access.h (size, empty, data): Add conditional
            noexcept to generic overloads.

diff --git a/libstdc++-v3/include/bits/range_access.h 
b/libstdc++-v3/include/bits/range_access.h
index 3987c2addf1..2a037ad8082 100644
--- a/libstdc++-v3/include/bits/range_access.h
+++ b/libstdc++-v3/include/bits/range_access.h
@@ -230,7 +230,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #endif // C++14
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
 #define __cpp_lib_nonmember_container_access 201411
 
   /**
@@ -239,7 +239,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    */
   template <typename _Container>
     constexpr auto
-    size(const _Container& __cont) -> decltype(__cont.size())
+    size(const _Container& __cont) noexcept(noexcept(__cont.size()))
+    -> decltype(__cont.size())
     { return __cont.size(); }
 
   /**
@@ -257,7 +258,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    */
   template <typename _Container>
     constexpr auto
-    empty(const _Container& __cont) -> decltype(__cont.empty())
+    empty(const _Container& __cont) noexcept(noexcept(__cont.empty()))
+    -> decltype(__cont.empty())
     { return __cont.empty(); }
 
   /**
@@ -284,7 +286,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    */
   template <typename _Container>
     constexpr auto
-    data(_Container& __cont) -> decltype(__cont.data())
+    data(_Container& __cont) noexcept(noexcept(__cont.data()))
+    -> decltype(__cont.data())
     { return __cont.data(); }
 
   /**
@@ -293,7 +296,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    */
   template <typename _Container>
     constexpr auto
-    data(const _Container& __cont) -> decltype(__cont.data())
+    data(const _Container& __cont) noexcept(noexcept(__cont.data()))
+    -> decltype(__cont.data())
     { return __cont.data(); }
 
   /**

Reply via email to