Re: [Boost-bugs] [Boost C++ Libraries] #10196: thread_specific_ptr does not support void*

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10196: thread_specific_ptr does not support void*
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-07-23 21:53:11


#10196: thread_specific_ptr does not support void*
--------------------------------------+----------------------
  Reporter: Zhihao Yuan <lichray@…> | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.54.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------+----------------------

Comment (by Zhihao Yuan <lichray@…>):

 Replying to [comment:5 viboes]:
> Well it seems that this compiles, but I'm getting these warnings
>
>
> {{{
> clang-darwin.compile.c++
 ../../../bin.v2/libs/thread/test/test_tss_lib.test/clang-
 darwin-3.2_11/debug/threading-multi/test_tss.o
> In file included from test_tss.cpp:13:
> ../../../boost/thread/tss.hpp:42:17: warning: cannot delete expression
 with pointer-to-'void' type 'void *'
> delete static_cast<T*>(data);
> ^ ~~~~~~~~~~~~~~~~~~~~~
> ../../../boost/thread/pthread/thread_heap_alloc.hpp:17:24: note: in
 instantiation of member function
 'boost::thread_specific_ptr<void>::delete_data::operator()' requested here
> return new T();
> ^
> ../../../boost/thread/tss.hpp:68:21: note: in instantiation of function
 template specialization
 'boost::detail::heap_new<boost::thread_specific_ptr<void>::delete_data>'
 requested here
>
 cleanup(detail::heap_new<delete_data>(),detail::do_heap_delete<delete_data>())
> ^
> test_tss.cpp:51:34: note: in instantiation of member function
 'boost::thread_specific_ptr<void>::thread_specific_ptr' requested here
> boost::thread_specific_ptr<void> tss_void;
> ^
> 1 warning generated.
>
> }}}

 C++11's default_delete is ill-formed for incomplete types including void.

 It's boost::shared_ptr's job to decide whether deleting void* is OK or
 not.

>
> How do you want to use it?

 Many C APIs expose their interface types with an opaque pointer; void* is
 a
 choice. You'll need to use a customized deleter calling the C API's
 cleanup
 function.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10196#comment:6>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC