Using boost 1.42, the attached fails to compile with g++:
shared_ptr_test.cpp: In instantiation of ‘Wrapper<A>’:
/usr/include/boost/smart_ptr/detail/sp_convertible.hpp:48: instantiated from
‘boost::detail::sp_convertible’
/usr/include/boost/smart_ptr/detail/sp_convertible.hpp:67: instantiated from
‘boost::detail::sp_enable_if_convertible’
shared_ptr_test.cpp:33: instantiated from here
shared_ptr_test.cpp :14: error: invalid use of incomplete type ‘struct A’
shared_ptr_test.cpp:5: error: forward declaration of ‘struct A’
This is surprising to me as the code does not use A anywhere.
I found BOOST_SP_NO_SP_CONVERTIBLE in shared_ptr.hpp and indeed
turning that on fixes the problem. Unfortunately, it doesn't seem to
be documented.
What's the rationale for the enable_if'd constructor? Is
BOOST_SP_NO_SP_CONVERTIBLE an official part of the
library? Apparently it is causing gcc to check all doSomething
members of Action against shared_ptr
and those checks are causing instantiations of Wrapper<A>.
-Dave