This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++0x] nullptr


On Sat, Jun 5, 2010 at 8:36 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 5 June 2010 18:57, Paolo Carlini wrote:
>>
>> first, thanks a lot! I'm still traveling and looking at your code in a tiny
>> screen: I'm a bit worried by some _M_dispose full specializations not marked
>> inline, can you double check?
>
> Changed by the patch below.
>
> In case it's not obvious, those specializations will never be called,
> but without them we instantiate the primary template which tries to
> 'delete nullptr' which is invalid.
>
> I considered a partial specialization of _Sp_counter_ptr<nullptr_t,
> _Lp> with _M_dispose and _M_destroy declared pure virtual, but decided
> to just specialize _M_dispose as a no-op instead.

I now get

ols.ver -soname libstdc++.so.6
.libs/thread.o: In function `std::_Sp_counted_ptr<decltype(nullptr),
(__gnu_cxx::_Lock_policy)0>::_M_dispose()':
/abuild/rguenther/obj/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr_base.h:113:
multiple definition of `std::_Sp_counted_ptr<decltype(nullptr),
(__gnu_cxx::_Lock_policy)0>::_M_dispose()'
.libs/functexcept.o:/abuild/rguenther/obj/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr_base.h:113:
first defined here
.libs/thread.o: In function `std::_Sp_counted_ptr<decltype(nullptr),
(__gnu_cxx::_Lock_policy)1>::_M_dispose()':
/abuild/rguenther/obj/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr_base.h:117:
multiple definition of `std::_Sp_counted_ptr<decltype(nullptr),
(__gnu_cxx::_Lock_policy)1>::_M_dispose()'
.libs/functexcept.o:/abuild/rguenther/obj/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr_base.h:117:
first defined here
...

which is before this patch.  Checking if it solved it.

Richard.

> 2010-06-05 ?Jonathan Wakely ?<jwakely.gcc@gmail.com>
>
> ? ? ? ?* include/bits/shared_ptr_base.h (_Sp_counted_ptr::_M_dispose): Make
> ? ? ? ?nullptr_t specializations inline.
>
>
>
> Index: include/bits/shared_ptr_base.h
> ===================================================================
> --- include/bits/shared_ptr_base.h ? ? ?(revision 160324)
> +++ include/bits/shared_ptr_base.h ? ? ?(working copy)
> @@ -109,15 +109,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
> ? ? };
>
> ? template<>
> - ? ?void
> + ? ?inline void
> ? ? _Sp_counted_ptr<nullptr_t, _S_single>::_M_dispose() { }
>
> ? template<>
> - ? ?void
> + ? ?inline void
> ? ? _Sp_counted_ptr<nullptr_t, _S_mutex>::_M_dispose() { }
>
> ? template<>
> - ? ?void
> + ? ?inline void
> ? ? _Sp_counted_ptr<nullptr_t, _S_atomic>::_M_dispose() { }
>
> ? // Support for custom deleter and/or allocator
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]