Boost logo

Boost Users :

Subject: [Boost-users] cannot pass objects of non-POD type ‘class boost::detail::shared_count’ through ‘...’; call will abort at runtime
From: Dave Steffen (dave.steffen_at_[hidden])
Date: 2009-09-16 17:59:11


Hi Folks

Just tried to compile my project with GCC 4.3 and Boost 1.40. (It
compiles and works just fine with Boost 1.38.)

As part of a home-built thread-locking shared pointer thing, we have
this code:

   /// Constructor from pointer to complete type
    template<class Y>
    explicit shared_locking_ptr( Y * p ): px( p ), pn( p ) // Y must be
complete
    {
        boost::detail::sp_enable_shared_from_this( pn, p, p );
    }

which now produces this result:

../util/thread/shared_locking_ptr.hpp:57:9: warning: cannot pass objects of
non-POD type ‘class boost::detail::shared_count’ through ‘...’; call will
abort at runtime

In Boost 1.38, the relevent code in shared_ptr.hpp was this AFAICT:
   #ifdef _MANAGED
   [ ... ]
   #else // _MANAGED
   [...]
   
   inline void sp_enable_shared_from_this( shared_count const & /*pn*/, ... )
   {
   }
   
   #endif // _MANAGED

In 1.40, it's been changed to

   #ifdef _MANAGED
   [...]
   #else // _MANAGED
   
   inline void sp_enable_shared_from_this( ... )
   {
   }
   
   #endif // _MANAGED

Does anyone know why the change?

Has anybody else seen this problem?

It seems to me that GCC is correct, and that although it's an empty
function so it doesn't matter anyway, the earlier version is
preferable.

Alternately, does anyone know of a way to silence GCC's warning?

-- 
Dave Steffen, Ph.D - Software Engineer
Numerica Corporation (www.numerica.us <http://www.numerica.us/> ) 
4850 Hahns Peak Drive, Suite 200
Loveland, Colorado 80538
main (970) 461-2000 x 227
direct (970) 612-2327
fax (970) 461-2004
Email: dave.steffen_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net