public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-10127] libstdc++: Force-inline shared_ptr::operator bool() for C++20 [PR108636]
@ 2024-02-02 10:35 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2024-02-02 10:35 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:4b36925576d1097b20cddd29cf96c5b9ecfffc3d

commit r12-10127-g4b36925576d1097b20cddd29cf96c5b9ecfffc3d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Feb 1 18:37:34 2024 +0000

    libstdc++: Force-inline shared_ptr::operator bool() for C++20 [PR108636]
    
    This avoids a linker error with -fkeep-inline-functions when including
    <filesystem>. We can't backport the fix from trunk because it adds an
    export to the shared library. By marking the "missing" symbol
    always_inline for C++20 mode we don't need a definition in the library.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/108636
            * include/bits/shared_ptr_base.h (__shared_ptr::operator bool):
            Add always_inline attribute for C++20 and later.

Diff:
---
 libstdc++-v3/include/bits/shared_ptr_base.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index c22b397a1946..23c3b17d46f9 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -1666,6 +1666,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       { return _M_ptr; }
 
       /// Return true if the stored pointer is not null.
+#if __cplusplus >= 202002L
+      [[__gnu__::__always_inline__]]
+#endif
       explicit operator bool() const noexcept
       { return _M_ptr != nullptr; }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-02 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02 10:35 [gcc r12-10127] libstdc++: Force-inline shared_ptr::operator bool() for C++20 [PR108636] 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).