Boost logo

Boost :

Subject: [boost] Ominous Warning — should I be worried?
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2013-12-23 14:41:32


I'm compiling with VS10, and using Boost 1.49.0
“reference member is initialized to a temporary that doesn't persist after the constructor
exits”
That does not sound good, and browsing through the mailing list archives I see discussions
of regressions in 2010 that cite C4413 and use of emplace.
I can't read the source code because it's just a ball of preprocessor stuff. Is this a
real problem or a warning that can be ignored? I would think that if Boost.Container was
broken on VS10, it would be mentioned somewhere where it's easy to spot.

Thanks,
—John

E:\boost_1_49\boost/preprocessor/iteration/detail/local.hpp(37): warning C4413:
'boost::container::container_detail::advanced_insert_aux_non_movable_emplace1arg<A,Iterator,P0>::m_p0'
: reference member is initialized to a temporary that doesn't persist after the
constructor exits
           with
           [
A=std::allocator<std::tr1::shared_ptr<MyTypeA>>,
               Iterator=std::tr1::shared_ptr<MyTypeA> *,
               P0=std::tr1::shared_ptr<MyTypeA>
           ]
E:\boost_1_49\boost/preprocessor/iteration/detail/local.hpp(37) : see declaration of
'boost::container::container_detail::advanced_insert_aux_non_movable_emplace1arg<A,Iterator,P0>::m_p0'
           with
           [
A=std::allocator<std::tr1::shared_ptr<MyTypeA>>,
               Iterator=std::tr1::shared_ptr<MyTypeA> *,
               P0=std::tr1::shared_ptr<MyTypeA>
           ]
E:\boost_1_49\boost/preprocessor/iteration/detail/local.hpp(37) : while compiling class
template member function
'boost::container::container_detail::advanced_insert_aux_non_movable_emplace1arg<A,Iterator,P0>::advanced_insert_aux_non_movable_emplace1arg(A
&,P0 &&)'
           with
           [
A=std::allocator<std::tr1::shared_ptr<MyTypeA>>,
               Iterator=std::tr1::shared_ptr<MyTypeA> *,
               P0=std::tr1::shared_ptr<MyTypeA>
           ]
E:\boost_1_49\boost/preprocessor/iteration/detail/local.hpp(37) : see reference to class
template instantiation
'boost::container::container_detail::advanced_insert_aux_non_movable_emplace1arg<A,Iterator,P0>'
being compiled
           with
           [
A=std::allocator<std::tr1::shared_ptr<MyTypeA>>,
               Iterator=std::tr1::shared_ptr<MyTypeA> *,
               P0=std::tr1::shared_ptr<MyTypeA>
           ]
E:\boost_1_49\boost/preprocessor/iteration/detail/local.hpp(37) : see reference to class
template instantiation
'boost::container::container_detail::advanced_insert_aux_emplace1arg<A,Iterator,P0>' being
compiled
           with
           [
A=std::allocator<std::tr1::shared_ptr<MyTypeA>>,
               Iterator=std::tr1::shared_ptr<MyTypeA> *,
               P0=std::tr1::shared_ptr<MyTypeA>
           ]
           mysourcefile.cpp(172) : see reference to function template instantiation 'void
boost::container::vector<T>::emplace_back<std::tr1::shared_ptr<_Ty>>(P0 &&)' being compiled
           with
           [
               T=std::tr1::shared_ptr<MyTypeA>,
               _Ty=MyTypeA,
               P0=std::tr1::shared_ptr<MyTypeA>
           ]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk