[gcc/devel/gccgo] libstdc++: Add inline to maybe-constexpr functions (PR 92927)

Ian Lance Taylor ian@gcc.gnu.org
Wed Jan 22 23:47:00 GMT 2020


https://gcc.gnu.org/g:7770bd7e9a889532b1970f372f3566fe86b13f09

commit 7770bd7e9a889532b1970f372f3566fe86b13f09
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Dec 20 17:10:18 2019 +0000

    libstdc++: Add inline to maybe-constexpr functions (PR 92927)
    
    Originally these functions were always inline. I changed them in r277342
    to be always constexpr, then in r277588 changed them to be constexpr for
    C++14, but I didn't restore the 'inline' for C++11. That leads to linker
    errors when libstdc++.so is built unoptimized, because those functions
    don't get instantiated in src/c++11/string-inst.o
    
    	PR libstdc++/92927
    	* include/bits/alloc_traits.h (__alloc_on_copy, __alloc_on_move)
    	(__alloc_on_swap): Add inline specifier.
    
    From-SVN: r279656

Diff:
---
 libstdc++-v3/ChangeLog                   | 6 ++++++
 libstdc++-v3/include/bits/alloc_traits.h | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 81f7bb9..663312d 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-20  Jonathan Wakely  <jwakely@redhat.com>
+
+	PR libstdc++/92927
+	* include/bits/alloc_traits.h (__alloc_on_copy, __alloc_on_move)
+	(__alloc_on_swap): Add inline specifier.
+
 2019-12-20  Jerome Lambourg  <lambourg@adacore.com>
 
 	* acinclude.m4 (GLIBCXX_CHECK_SETRLIMIT): Test with AC_LANG_CPLUSPLUS.
diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h
index 142b23f..812cff0 100644
--- a/libstdc++-v3/include/bits/alloc_traits.h
+++ b/libstdc++-v3/include/bits/alloc_traits.h
@@ -567,7 +567,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
   template<typename _Alloc>
-    _GLIBCXX14_CONSTEXPR void
+    _GLIBCXX14_CONSTEXPR inline void
     __alloc_on_copy(_Alloc& __one, const _Alloc& __two)
     {
       typedef allocator_traits<_Alloc> __traits;
@@ -599,7 +599,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
   template<typename _Alloc>
-    _GLIBCXX14_CONSTEXPR void
+    _GLIBCXX14_CONSTEXPR inline void
     __alloc_on_move(_Alloc& __one, _Alloc& __two)
     {
       typedef allocator_traits<_Alloc> __traits;
@@ -626,7 +626,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
   template<typename _Alloc>
-    _GLIBCXX14_CONSTEXPR void
+    _GLIBCXX14_CONSTEXPR inline void
     __alloc_on_swap(_Alloc& __one, _Alloc& __two)
     {
       typedef allocator_traits<_Alloc> __traits;



More information about the Libstdc++-cvs mailing list