Hi.
The following source code does not compile in XCode 4.5 (it is
developer preview 2 version at this moment).
I've got answer from one of the apple guys: "It's a known issue that
when using libc++ in C++11 mode, instantiating std::list causes
instantiation of the element type more aggressively than other
std::list implementations. This probably won't be fixed for Xcode
4.5."
Source code:
#include <functional>
#include <iostream>
#include <boost/statechart/state.hpp>
#include <boost/statechart/state_machine.hpp>
class InitialState;
class StateMachine : public
boost::statechart::state_machine<StateMachine, InitialState>
{
public:
StateMachine()
{
}
};
class InitialState : public
boost::statechart::simple_state<InitialState, StateMachine>
{
public:
InitialState()
{
}
};
int main(int argc, char const* argv[])
{
std::cout << "Hello, World!\n";
StateMachine s;
return 0;
}
Errors:
In file included from /Users/developer/Downloads/Sandbox/Sandbox/main.cpp:12:
In file included from /usr/local/boost_1_50_0/boost/statechart/state.hpp:11:
In file included from
/usr/local/boost_1_50_0/boost/statechart/simple_state.hpp:13:
/usr/local/boost_1_50_0/boost/statechart/detail/leaf_state.hpp:26:27:
error: base class has incomplete type
class leaf_state : public state_base< Allocator, RttiPolicy >
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:1889:54:
note: in instantiation of template class
'boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>' requested here
decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...)), true_type())
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:1890:1:
note: while substituting deduced template arguments into function
template '__is_constructible_test' [with _Tp =
std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>>, _Args = <no
value>]
__is_constructible_test(_Tp&&, _Args&& ...);
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:1949:14:
note: in instantiation of template class
'std::__1::__is_constructible<false,
std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>>,
std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>> &&>' requested here
: public __is_constructible<is_scalar<_Tp>::value ||
is_reference<_Tp>::value,
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:1975:14:
note: in instantiation of template class
'std::__1::__is_constructible_void_check<false,
std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>>,
std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>> &&>' requested here
: public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2455:34:
note: in instantiation of template class
'std::__1::is_constructible<std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>>,
std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>> &&>' requested here
: __is_nothrow_constructible<is_constructible<_Tp,
_Args...>::value, _Tp, _Args...>
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2590:14:
note: (skipping 3 contexts in backtrace; use
-ftemplate-backtrace-limit=0 to see all)
: public is_nothrow_constructible<_Tp, typename
add_rvalue_reference<_Tp>::type>
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/list:513:52:
note: in instantiation of template class
'std::__1::__compressed_pair<unsigned long,
std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>>>' requested here
__compressed_pair<size_type, __node_allocator> __size_alloc_;
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/list:770:15:
note: in instantiation of template class
'std::__1::__list_imp<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>,
std::__1::allocator<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>>>' requested here
: private __list_imp<_Tp, _Alloc>
^
/usr/local/boost_1_50_0/boost/statechart/detail/state_base.hpp:139:16:
note: in instantiation of template class
'std::__1::list<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>,
std::__1::allocator<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>>>' requested here
typename state_list_type::iterator & statesEnd,
^
/usr/local/boost_1_50_0/boost/statechart/state_machine.hpp:510:22:
note: in instantiation of template class
'boost::statechart::detail::state_base<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>' requested here
typedef typename state_base_type::node_state_base_ptr_type
^
/Users/developer/Downloads/Sandbox/Sandbox/main.cpp:17:29: note: in
instantiation of template class
'boost::statechart::state_machine<StateMachine, InitialState,
std::__1::allocator<void>,
boost::statechart::null_exception_translator>' requested here
class StateMachine : public
boost::statechart::state_machine<StateMachine, InitialState>
^
/usr/local/boost_1_50_0/boost/statechart/detail/state_base.hpp:57:7:
note: definition of
'boost::statechart::detail::state_base<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>' is not complete until the
closing '}'
class state_base :
^
In file included from /Users/developer/Downloads/Sandbox/Sandbox/main.cpp:12:
In file included from /usr/local/boost_1_50_0/boost/statechart/state.hpp:11:
In file included from
/usr/local/boost_1_50_0/boost/statechart/simple_state.hpp:13:
/usr/local/boost_1_50_0/boost/statechart/detail/leaf_state.hpp:44:44:
error: no type named 'iterator' in
'std::__1::list<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>,
std::__1::allocator<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>>>'
typename base_type::state_list_type::iterator listPosition )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/local/boost_1_50_0/boost/statechart/detail/leaf_state.hpp:53:44:
error: no type named 'iterator' in
'std::__1::list<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>,
std::__1::allocator<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>>>'
typename base_type::state_list_type::iterator & statesEnd,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/local/boost_1_50_0/boost/statechart/detail/leaf_state.hpp:73:42:
error: no type named 'iterator' in
'std::__1::list<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>,
std::__1::allocator<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>>>'
typename base_type::state_list_type::iterator listPosition_;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /Users/developer/Downloads/Sandbox/Sandbox/main.cpp:12:
In file included from /usr/local/boost_1_50_0/boost/statechart/state.hpp:11:
/usr/local/boost_1_50_0/boost/statechart/simple_state.hpp:505:27:
error: no type named 'direct_state_base_ptr_type' in
'boost::statechart::detail::rtti_policy::rtti_derived_type<InitialState,
boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>'
typename base_type::direct_state_base_ptr_type & pSelf,
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/developer/Downloads/Sandbox/Sandbox/main.cpp:25:29: note: in
instantiation of template class
'boost::statechart::simple_state<InitialState, StateMachine,
boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na>, 0>' requested here
class InitialState : public
boost::statechart::simple_state<InitialState, StateMachine>
^
In file included from /Users/developer/Downloads/Sandbox/Sandbox/main.cpp:12:
In file included from /usr/local/boost_1_50_0/boost/statechart/state.hpp:11:
In file included from
/usr/local/boost_1_50_0/boost/statechart/simple_state.hpp:11:
In file included from /usr/local/boost_1_50_0/boost/statechart/event.hpp:11:
In file included from
/usr/local/boost_1_50_0/boost/statechart/event_base.hpp:15:
In file included from /usr/local/boost_1_50_0/boost/intrusive_ptr.hpp:16:
/usr/local/boost_1_50_0/boost/smart_ptr/intrusive_ptr.hpp:96:23:
error: no matching function for call to 'intrusive_ptr_release'
if( px != 0 ) intrusive_ptr_release( px );
^~~~~~~~~~~~~~~~~~~~~
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:1621:23:
note: in instantiation of member function
'boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy> >::~intrusive_ptr' requested
here
__p->~_Tp();
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:1522:14:
note: in instantiation of function template specialization
'std::__1::allocator_traits<std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>>
>::__destroy<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>> >' requested here
{__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/list:685:34:
note: in instantiation of function template specialization
'std::__1::allocator_traits<std::__1::allocator<std::__1::__list_node<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>, void *>>
>::destroy<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>> >' requested here
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/list:664:5:
note: in instantiation of member function
'std::__1::__list_imp<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>,
std::__1::allocator<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>> >::clear' requested here
clear();
^
/Developer4/Xcode45-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/list:769:23:
note: in instantiation of member function
'std::__1::__list_imp<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>,
std::__1::allocator<boost::intrusive_ptr<boost::statechart::detail::leaf_state<std::__1::allocator<void>,
boost::statechart::detail::rtti_policy>>> >::~__list_imp' requested
here
class _LIBCPP_VISIBLE list
^
/Users/developer/Downloads/Sandbox/Sandbox/main.cpp:20:5: note: in
instantiation of member function
'boost::statechart::state_machine<StateMachine, InitialState,
std::__1::allocator<void>,
boost::statechart::null_exception_translator>::state_machine'
requested here
StateMachine()
^
/usr/local/boost_1_50_0/boost/statechart/detail/state_base.hpp:165:13:
note: candidate template ignored: failed template argument deduction
inline void intrusive_ptr_release(
^
6 errors generated.
***
So, it looks like it became boost's problem. Any help?
WBR, Anton.