Re: [Boost-bugs] [Boost C++ Libraries] #6943: gcc 4.7 issue in combination with intrusive_ptr_add_ref and intrusive_ptr_release (boost_1_49_0/boost/intrusive_ptr.hpp - boost_1_49_0/boost/smart_ptr/intrusive_ptr.hpp )

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6943: gcc 4.7 issue in combination with intrusive_ptr_add_ref and intrusive_ptr_release (boost_1_49_0/boost/intrusive_ptr.hpp - boost_1_49_0/boost/smart_ptr/intrusive_ptr.hpp )
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-06-15 17:12:06


#6943: gcc 4.7 issue in combination with intrusive_ptr_add_ref and
intrusive_ptr_release (boost_1_49_0/boost/intrusive_ptr.hpp -
boost_1_49_0/boost/smart_ptr/intrusive_ptr.hpp )
---------------------------------------------------+------------------------
  Reporter: Joop Boonen <joop.boonen@…> | Owner: igaztanaga
      Type: Bugs | Status: new
 Milestone: Boost 1.49.0 | Component: intrusive
   Version: Boost 1.49.0 | Severity: Regression
Resolution: | Keywords:
---------------------------------------------------+------------------------

Comment (by safety0ff.bugz@…):

 I had the same error/issue. My code had the form:

 {{{
 // Header 1

 class SomeClass;
 namespace boost
 {
         void intrusive_ptr_add_ref(SomeClass* psRPFT);
         void intrusive_ptr_release(SomeClass* psRPFT);
 };

 class SomeClass
 {
 // stuff, including a private variable called reference_count
         friend void ::boost::intrusive_ptr_add_ref(SomeClass* psSC);
         friend void ::boost::intrusive_ptr_release(SomeClass* psSC);
 };

 namespace boost
 {
         inline void intrusive_ptr_add_ref(SomeClass* psSC)
         {
                 ++(psSC->reference_count);
         }

         inline void intrusive_ptr_release(SomeClass* psSC)
         {
                 --(psSC->reference_count);
         }
 };

 // Header 2

 // include Header 1
 using boost::intrusive_ptr;

 // Source file 2

 // Include header 2 and do something that invokes the copy constructor of
 intrusive_ptr
 }}}

 My solution was to change:
 {{{
 using boost::intrusive_ptr;
 }}}
 to
 {{{
 using boost::intrusive_ptr;
 using boost::intrusive_ptr_add_ref;
 using boost::intrusive_ptr_release;
 }}}
 It this was slightly unexpected for me.[[BR]]
 It compiled without the change on gcc 4.5.3 but would not on clang 3.1 and
 gcc 4.7.0

 Not sure if it is a bug (would like clarification.)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6943#comment:1>
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:09 UTC