libstdc++: Remove incorrect static specifiers
authorJonathan Wakely <jwakely@redhat.com>
Sat, 23 May 2020 08:00:16 +0000 (09:00 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 23 May 2020 08:40:16 +0000 (09:40 +0100)
These functions were originally static members of the path class, but
the 'static' specifiers were not removed when they were moved to
namespace scope. This causes ODR violations when the functions are
called from functions defined in the header, which is incompatible with
Nathan's modules branch.  Change them to 'inline' instead.

* include/bits/fs_path.h (__detail::_S_range_begin)
(__detail::_S_range_end): Remove unintentional static specifiers.
* include/experimental/bits/fs_path.h (__detail::_S_range_begin)
(__detail::_S_range_end): Likewise.

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fs_path.h
libstdc++-v3/include/experimental/bits/fs_path.h

index b82479f..af52f14 100644 (file)
@@ -1,5 +1,10 @@
 2020-05-23  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/bits/fs_path.h (__detail::_S_range_begin)
+       (__detail::_S_range_end): Remove unintentional static specifiers.
+       * include/experimental/bits/fs_path.h (__detail::_S_range_begin)
+       (__detail::_S_range_end): Likewise.
+
        * include/bits/fs_path.h (filesystem::__detail::__is_encoded_char):
        Replace alias template with variable template. Don't remove const.
        (filesystem::__detail::__is_path_src): Replace overloaded function
index 5a99828..818b591 100644 (file)
@@ -156,32 +156,32 @@ namespace __detail
     using _Path2 = enable_if_t<__is_path_iter_src<_Tr>::value, path>;
 
   template<typename _Source>
-    static _Source
+    _Source
     _S_range_begin(_Source __begin) { return __begin; }
 
   struct __null_terminated { };
 
   template<typename _Source>
-    static __null_terminated
+    __null_terminated
     _S_range_end(_Source) { return {}; }
 
   template<typename _CharT, typename _Traits, typename _Alloc>
-    static const _CharT*
+    inline const _CharT*
     _S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str)
     { return __str.data(); }
 
   template<typename _CharT, typename _Traits, typename _Alloc>
-    static const _CharT*
+    inline const _CharT*
     _S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str)
     { return __str.data() + __str.size(); }
 
   template<typename _CharT, typename _Traits>
-    static const _CharT*
+    inline const _CharT*
     _S_range_begin(const basic_string_view<_CharT, _Traits>& __str)
     { return __str.data(); }
 
   template<typename _CharT, typename _Traits>
-    static const _CharT*
+    inline const _CharT*
     _S_range_end(const basic_string_view<_CharT, _Traits>& __str)
     { return __str.data() + __str.size(); }
 
index d7234c0..69b823a 100644 (file)
@@ -137,33 +137,33 @@ namespace __detail
                     path>::type;
 
   template<typename _Source>
-    static _Source
+    inline _Source
     _S_range_begin(_Source __begin) { return __begin; }
 
   struct __null_terminated { };
 
   template<typename _Source>
-    static __null_terminated
+    inline __null_terminated
     _S_range_end(_Source) { return {}; }
 
   template<typename _CharT, typename _Traits, typename _Alloc>
-    static const _CharT*
+    inline const _CharT*
     _S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str)
     { return __str.data(); }
 
   template<typename _CharT, typename _Traits, typename _Alloc>
-    static const _CharT*
+    inline const _CharT*
     _S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str)
     { return __str.data() + __str.size(); }
 
 #if __cplusplus >= 201402L
   template<typename _CharT, typename _Traits>
-    static const _CharT*
+    inline const _CharT*
     _S_range_begin(const basic_string_view<_CharT, _Traits>& __str)
     { return __str.data(); }
 
   template<typename _CharT, typename _Traits>
-    static const _CharT*
+    inline const _CharT*
     _S_range_end(const basic_string_view<_CharT, _Traits>& __str)
     { return __str.data() + __str.size(); }
 #endif