On Aug 24, 2022, Jonathan Wakely via Gcc-patches <gcc-patches@gcc.gnu.org> 
wrote:

>            * include/bits/basic_string.h (operator+(const string&,
> const char*)):
>            Remove naive implementation.
>            * include/bits/basic_string.tcc (operator+(const string&,
> const char*)):
>            Add single-allocation implementation.

ISTM this requires the following additional tweak:

diff --git a/libstdc++-v3/src/c++11/string-inst.cc 
b/libstdc++-v3/src/c++11/string-inst.cc
index bfae6d902a1dd..2ec0e9d85f947 100644
--- a/libstdc++-v3/src/c++11/string-inst.cc
+++ b/libstdc++-v3/src/c++11/string-inst.cc
@@ -58,6 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template class basic_string<C>;
   template S operator+(const C*, const S&);
+  template S operator+(const S&, const C*);
   template S operator+(C, const S&);
   template S operator+(const S&, const S&);
 

Without this, I'm getting undefined references to this specialization in
libstdc++.so, that I tracked down to a std::system_error ctor in
cxx11-ios_failure.o.  I got this while testing another patch that might
be the reason why the template instantiation doesn't get inlined, but...
we can't depend on its being inlined, can we?

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

Reply via email to