This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [C++0x] nullptr
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.
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