On Mon, 17 Jan 2022 at 09:39, Stephan Bergmann <sberg...@redhat.com> wrote:
> On 1/17/22 01:12, Jonathan Wakely via Libstdc++ wrote: > > Here's the finished version of that patch, which is all inline in the > > header, and performs faster too. > > > > Tested powerpc64le-linux and x86_64-linux. > > Pushed to trunk. > > FYI, recent Clang still requires typename in two places to compile > <memory> with -std=c++20, > > > diff --git a/libstdc++-v3/include/bits/shared_ptr_atomic.h > b/libstdc++-v3/include/bits/shared_ptr_atomic.h > > index 900499bae32..50aa46370ca 100644 > > --- a/libstdc++-v3/include/bits/shared_ptr_atomic.h > > +++ b/libstdc++-v3/include/bits/shared_ptr_atomic.h > > @@ -456,8 +456,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > typename _Tp::element_type* _M_ptr; > > _Atomic_count _M_refcount; > > > > - static _Atomic_count::pointer > > - _S_add_ref(_Atomic_count::pointer __p) > > + static typename _Atomic_count::pointer > > + _S_add_ref(typename _Atomic_count::pointer __p) > > { > > if (__p) > > { > Sigh, yes, I already noticed this myself. Clang is wrong (P0634R0 gives an example *very* similar to this as motivation for the change), but we need to keep writing the code in C++17 style if we want to be compatible with released versions of Clang. Fixed by the attached patch, tested x86_64-linux and pushed to trunk.
commit a923345c72aef9ebb6b32f81f4825acc11085803 Author: Jonathan Wakely <jwak...@redhat.com> Date: Mon Jan 17 09:42:35 2022 libstdc++: Add 'typename' to dependent types in atomic<shared_ptr<T>> libstdc++-v3/ChangeLog: * include/bits/shared_ptr_atomic.h (_Sp_atomic): Add typename to qualified-id for dependent type. diff --git a/libstdc++-v3/include/bits/shared_ptr_atomic.h b/libstdc++-v3/include/bits/shared_ptr_atomic.h index 900499bae32..50aa46370ca 100644 --- a/libstdc++-v3/include/bits/shared_ptr_atomic.h +++ b/libstdc++-v3/include/bits/shared_ptr_atomic.h @@ -456,8 +456,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typename _Tp::element_type* _M_ptr; _Atomic_count _M_refcount; - static _Atomic_count::pointer - _S_add_ref(_Atomic_count::pointer __p) + static typename _Atomic_count::pointer + _S_add_ref(typename _Atomic_count::pointer __p) { if (__p) {