我在VS2015中收到错误“异常规范不能出现在typedef声明中”,它似乎来自
template <typename T, bool isp, bool b1, bool b2>
struct ct_imp
{
typedef const T& param_type;
};
和其他地方
template <typename T>
struct call_traits
{
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
//
// C++ Builder workaround: we should be able to define a compile time
// constant and pass that as a single template parameter to ct_imp<T,bool>,
// however compiler bugs prevent this - instead pass three bool's to
// ct_imp<T,bool,bool,bool> and add an extra partial specialisation
// of ct_imp to handle the logic. (JM)
typedef typename boost::detail::ct_imp<
T,
::boost::is_pointer<T>::value,
::boost::is_arithmetic<T>::value,
::boost::is_enum<T>::value
>::param_type param_type;
};
在call_traits.hpp文件中。
上述模板在另一个文件“compressed_pair.hpp”中实例化,在这些地方也面临同样的错误。
class compressed_pair_imp<T1, T2, 2>
: protected ::boost::remove_cv<T2>::type
{
public:
typedef T1 first_type;
typedef T2 second_type;
typedef typename call_traits<first_type>::param_type first_param_type;
typedef typename call_traits<second_type>::param_type second_param_type;
typedef typename call_traits<first_type>::reference first_reference;
typedef typename call_traits<second_type>::reference second_reference;
typedef typename call_traits<first_type>::const_reference first_const_reference;
typedef typename call_traits<second_type>::const_reference second_const_reference;
这些是提升文件,我没有修改过。当我使用新的boost 1.58库在vs2015中构建我当前的项目时,我得到了这个错误。
以下是完整的编译细节。
CommandManager_Wrapper.cpp
1>c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(184): error C2279: exception specification cannot appear in a typedef declaration
1> c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(348): note: see reference to class template instantiation 'boost::details::compressed_pair_imp<T1,T2,2>' being compiled
1> with
1> [
1> T1=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> T2=boost::python::default_call_policies
1> ]
1> c:\boost\boost_1_58_0\boost/python/detail/caller.hpp(251): note: see reference to class template instantiation 'boost::compressed_pair<F,Policies>' being compiled
1> with
1> [
1> F=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> Policies=boost::python::default_call_policies
1> ]
1> c:\boost\boost_1_58_0\boost/python/detail/caller.hpp(169): note: see reference to class template instantiation 'boost::python::detail::caller_arity<1>::impl<F,CallPolicies,Sig>' being compiled
1> with
1> [
1> F=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> CallPolicies=boost::python::default_call_policies,
1> Sig=boost::mpl::vector2<unsigned int,CommandContextList &>
1> ]
1> c:\boost\boost_1_58_0\boost/python/make_function.hpp(61): note: see reference to class template instantiation 'boost::python::detail::caller<F,CallPolicies,Sig>' being compiled
1> with
1> [
1> F=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> CallPolicies=boost::python::default_call_policies,
1> Sig=boost::mpl::vector2<unsigned int,CommandContextList &>
1> ]
1> c:\boost\boost_1_58_0\boost/python/make_function.hpp(146): note: see reference to function template instantiation 'boost::python::api::object boost::python::detail::make_function_aux<F,CallPolicies,Signature,boost::mpl::int_<0>>(F,const CallPolicies &,const Sig &,const boost::python::detail::keyword_range &,NumKeywords)' being compiled
1> with
1> [
1> F=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> CallPolicies=boost::python::default_call_policies,
1> Signature=boost::mpl::vector2<unsigned int,CommandContextList &>,
1> Sig=boost::mpl::vector2<unsigned int,CommandContextList &>,
1> NumKeywords=boost::mpl::int_<0>
1> ]
1> c:\boost\boost_1_58_0\boost/python/class.hpp(545): note: see reference to function template instantiation 'boost::python::api::object boost::python::make_function<Fn,boost::python::default_call_policies,boost::python::detail::keywords<0>,boost::mpl::vector2<unsigned int,CommandContextList &>>(F,const CallPolicies &,const Keywords &,const Signature &)' being compiled
1> with
1> [
1> Fn=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> F=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> CallPolicies=boost::python::default_call_policies,
1> Keywords=boost::python::detail::keywords<0>,
1> Signature=boost::mpl::vector2<unsigned int,CommandContextList &>
1> ]
1> c:\boost\boost_1_58_0\boost/python/class.hpp(615): note: see reference to function template instantiation 'void boost::python::class_<CommandContextList,boost::noncopyable,boost::python::detail::not_specified,boost::python::detail::not_specified>::def_impl<CommandContextList,Fn,boost::python::detail::def_helper<A1,boost::python::detail::not_specified,boost::python::detail::not_specified,boost::python::detail::not_specified>>(T *,const char *,Fn,const Helper &,...)' being compiled
1> with
1> [
1> Fn=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> A1=char [45],
1> T=CommandContextList,
1> Helper=boost::python::detail::def_helper<char [45],boost::python::detail::not_specified,boost::python::detail::not_specified,boost::python::detail::not_specified>
1> ]
1> c:\boost\boost_1_58_0\boost/python/class.hpp(615): note: see reference to function template instantiation 'void boost::python::class_<CommandContextList,boost::noncopyable,boost::python::detail::not_specified,boost::python::detail::not_specified>::def_impl<CommandContextList,Fn,boost::python::detail::def_helper<A1,boost::python::detail::not_specified,boost::python::detail::not_specified,boost::python::detail::not_specified>>(T *,const char *,Fn,const Helper &,...)' being compiled
1> with
1> [
1> Fn=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> A1=char [45],
1> T=CommandContextList,
1> Helper=boost::python::detail::def_helper<char [45],boost::python::detail::not_specified,boost::python::detail::not_specified,boost::python::detail::not_specified>
1> ]
1> c:\boost\boost_1_58_0\boost/python/class.hpp(245): note: see reference to function template instantiation 'void boost::python::class_<CommandContextList,boost::noncopyable,boost::python::detail::not_specified,boost::python::detail::not_specified>::def_maybe_overloads<A1,char[45]>(const char *,Fn,const char (&),...)' being compiled
1> with
1> [
1> A1=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> Fn=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const
1> ]
1> c:\boost\boost_1_58_0\boost/python/class.hpp(245): note: see reference to function template instantiation 'void boost::python::class_<CommandContextList,boost::noncopyable,boost::python::detail::not_specified,boost::python::detail::not_specified>::def_maybe_overloads<A1,char[45]>(const char *,Fn,const char (&),...)' being compiled
1> with
1> [
1> A1=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> Fn=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const
1> ]
1> ..\..\..\OsIndependent\Libs\py_sfcl\CommandManager_Wrapper.cpp(155): note: see reference to function template instantiation 'boost::python::class_<CommandContextList,boost::noncopyable,boost::python::detail::not_specified,boost::python::detail::not_specified> &boost::python::class_<CommandContextList,boost::noncopyable,boost::python::detail::not_specified,boost::python::detail::not_specified>::def<unsigned int(__thiscall std::deque<CommandContextPtr,std::allocator<_Ty>>::* )(void) noexcept const,char[45]>(const char *,A1,const A2 (&))' being compiled
1> with
1> [
1> _Ty=CommandContextPtr,
1> A1=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> A2=char [45]
1> ]
1> ..\..\..\OsIndependent\Libs\py_sfcl\CommandManager_Wrapper.cpp(155): note: see reference to function template instantiation 'boost::python::class_<CommandContextList,boost::noncopyable,boost::python::detail::not_specified,boost::python::detail::not_specified> &boost::python::class_<CommandContextList,boost::noncopyable,boost::python::detail::not_specified,boost::python::detail::not_specified>::def<unsigned int(__thiscall std::deque<CommandContextPtr,std::allocator<_Ty>>::* )(void) noexcept const,char[45]>(const char *,A1,const A2 (&))' being compiled
1> with
1> [
1> _Ty=CommandContextPtr,
1> A1=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const,
1> A2=char [45]
1> ]
1>c:\boost\boost_1_58_0\boost/detail/call_traits.hpp(77): error C2279: exception specification cannot appear in a typedef declaration
1> c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(186): note: see reference to class template instantiation 'boost::call_traits<unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<_Ty>>::* )(void) noexcept const>' being compiled
1> with
1> [
1> _Ty=CommandContextPtr
1> ]
1>c:\boost\boost_1_58_0\boost/detail/call_traits.hpp(78): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/detail/call_traits.hpp(79): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/detail/call_traits.hpp(50): error C2279: exception specification cannot appear in a typedef declaration
1> c:\boost\boost_1_58_0\boost/detail/call_traits.hpp(91): note: see reference to class template instantiation 'boost::detail::ct_imp<T,false,false,false>' being compiled
1> with
1> [
1> T=unsigned int (__thiscall std::deque<CommandContextPtr,std::allocator<CommandContextPtr>>::* )(void) noexcept const
1> ]
1>c:\boost\boost_1_58_0\boost/detail/call_traits.hpp(91): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(186): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(188): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(190): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(358): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(360): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(362): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/detail/compressed_pair.hpp(364): error C2279: exception specification cannot appear in a typedef declaration
1>c:\boost\boost_1_58_0\boost/python/object/value_holder.hpp(133): warning C4459: declaration of 'self' hides global declaration
1> c:\boost\boost_1_58_0\boost/python/self.hpp(24): note: see declaration of 'boost::python::self_ns::self'
1> c:\boost\boost_1_58_0\boost/type_traits/alignment_of.hpp(42): note: see reference to class template instantiation 'boost::python::objects::value_holder<T>' being compiled
1> with
1> [
1> T=CommandContext_Net
1> ]
1> c:\boost\boost_1_58_0\boost/type_traits/alignment_of.hpp(65): note: see reference to class template instantiation 'boost::detail::alignment_of_hack<T>' being compiled
1> with
1> [
1> T=boost::python::objects::value_holder<CommandContext_Net>
1> ]
1> c:\boost\boost_1_58_0\boost/type_traits/alignment_of.hpp(89): note: see reference to class template instantiation 'boost::detail::alignment_of_impl<T>' being compiled
1> with
1> [
1> T=boost::python::objects::value_holder<CommandContext_Net>
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/instance.hpp(29): note: see reference to class template instantiation 'boost::alignment_of<Data>' being compiled
1> with
1> [
1> Data=boost::python::objects::value_holder<CommandContext_Net>
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/instance.hpp(44): note: see reference to class template instantiation 'boost::python::objects::instance<Holder>' being compiled
1> with
1> [
1> Holder=boost::python::objects::value_holder<CommandContext_Net>
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/make_instance.hpp(35): note: see reference to class template instantiation 'boost::python::objects::additional_instance_size<Holder>' being compiled
1> with
1> [
1> Holder=boost::python::objects::value_holder<CommandContext_Net>
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_wrapper.hpp(29): note: see reference to function template instantiation 'PyObject *boost::python::objects::make_instance_impl<T,Holder,boost::python::objects::make_instance<T,Holder>>::execute<const boost::reference_wrapper<const T>>(Arg &)' being compiled
1> with
1> [
1> T=CommandContext_Net,
1> Holder=boost::python::objects::value_holder<CommandContext_Net>,
1> Arg=const boost::reference_wrapper<const CommandContext_Net>
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_wrapper.hpp(29): note: see reference to function template instantiation 'PyObject *boost::python::objects::make_instance_impl<T,Holder,boost::python::objects::make_instance<T,Holder>>::execute<const boost::reference_wrapper<const T>>(Arg &)' being compiled
1> with
1> [
1> T=CommandContext_Net,
1> Holder=boost::python::objects::value_holder<CommandContext_Net>,
1> Arg=const boost::reference_wrapper<const CommandContext_Net>
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_wrapper.hpp(28): note: while compiling class template member function 'PyObject *boost::python::objects::class_cref_wrapper<T2,boost::python::objects::make_instance<T2,boost::python::objects::value_holder<T>>>::convert(const Src &)'
1> with
1> [
1> T2=CommandContext_Net,
1> T=CommandContext_Net,
1> Src=CommandContext_Net
1> ]
1> c:\boost\boost_1_58_0\boost/python/converter/as_to_python_function.hpp(27): note: see reference to function template instantiation 'PyObject *boost::python::objects::class_cref_wrapper<T2,boost::python::objects::make_instance<T2,boost::python::objects::value_holder<T>>>::convert(const Src &)' being compiled
1> with
1> [
1> T2=CommandContext_Net,
1> T=CommandContext_Net,
1> Src=CommandContext_Net
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_metadata.hpp(272): note: see reference to class template instantiation 'boost::python::objects::class_cref_wrapper<T2,boost::python::objects::make_instance<T2,boost::python::objects::value_holder<T>>>' being compiled
1> with
1> [
1> T2=CommandContext_Net,
1> T=CommandContext_Net
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_metadata.hpp(229): note: see reference to function template instantiation 'void boost::python::objects::class_metadata<W,X1,X2,X3>::maybe_register_class_to_python<T2>(T2 *,boost::mpl::false_)' being compiled
1> with
1> [
1> W=CommandContext_Net,
1> X1=boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,
1> X2=boost::python::detail::not_specified,
1> X3=boost::python::detail::not_specified,
1> T2=CommandContext_Net
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_metadata.hpp(229): note: see reference to function template instantiation 'void boost::python::objects::class_metadata<W,X1,X2,X3>::maybe_register_class_to_python<T2>(T2 *,boost::mpl::false_)' being compiled
1> with
1> [
1> W=CommandContext_Net,
1> X1=boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,
1> X2=boost::python::detail::not_specified,
1> X3=boost::python::detail::not_specified,
1> T2=CommandContext_Net
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_metadata.hpp(219): note: see reference to function template instantiation 'void boost::python::objects::class_metadata<W,X1,X2,X3>::register_aux2<T,use_callback>(T2 *,Callback)' being compiled
1> with
1> [
1> W=CommandContext_Net,
1> X1=boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,
1> X2=boost::python::detail::not_specified,
1> X3=boost::python::detail::not_specified,
1> T=CommandContext_Net,
1> T2=CommandContext_Net,
1> Callback=use_callback
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_metadata.hpp(219): note: see reference to function template instantiation 'void boost::python::objects::class_metadata<W,X1,X2,X3>::register_aux2<T,use_callback>(T2 *,Callback)' being compiled
1> with
1> [
1> W=CommandContext_Net,
1> X1=boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,
1> X2=boost::python::detail::not_specified,
1> X3=boost::python::detail::not_specified,
1> T=CommandContext_Net,
1> T2=CommandContext_Net,
1> Callback=use_callback
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_metadata.hpp(217): note: while compiling class template member function 'void boost::python::objects::class_metadata<W,X1,X2,X3>::register_aux(void *)'
1> with
1> [
1> W=CommandContext_Net,
1> X1=boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,
1> X2=boost::python::detail::not_specified,
1> X3=boost::python::detail::not_specified
1> ]
1> c:\boost\boost_1_58_0\boost/python/object/class_metadata.hpp(205): note: see reference to function template instantiation 'void boost::python::objects::class_metadata<W,X1,X2,X3>::register_aux(void *)' being compiled
1> with
1> [
1> W=CommandContext_Net,
1> X1=boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,
1> X2=boost::python::detail::not_specified,
1> X3=boost::python::detail::not_specified
1> ]
1> c:\boost\boost_1_58_0\boost/python/class.hpp(175): note: see reference to class template instantiation 'boost::python::objects::class_metadata<W,X1,X2,X3>' being compiled
1> with
1> [
1> W=CommandContext_Net,
1> X1=boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,
1> X2=boost::python::detail::not_specified,
1> X3=boost::python::detail::not_specified
1> ]
1> c:\boost\boost_1_58_0\boost/python/class.hpp(636): note: see reference to class template instantiation 'boost::python::class_<CommandContext_Net,boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,boost::python::detail::not_specified,boost::python::detail::not_specified>::id_vector' being compiled
1> c:\boost\boost_1_58_0\boost/python/class.hpp(636): note: while compiling class template member function 'boost::python::class_<CommandContext_Net,boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,boost::python::detail::not_specified,boost::python::detail::not_specified>::class_(const char *,boost::python::no_init_t)'
1> ..\..\..\OsIndependent\Libs\py_sfcl\CommandManager_Wrapper.cpp(128): note: see reference to function template instantiation 'boost::python::class_<CommandContext_Net,boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,boost::python::detail::not_specified,boost::python::detail::not_specified>::class_(const char *,boost::python::no_init_t)' being compiled
1> ..\..\..\OsIndependent\Libs\py_sfcl\CommandManager_Wrapper.cpp(128): note: see reference to class template instantiation 'boost::python::class_<CommandContext_Net,boost::python::bases<CommandContext,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_,boost::mpl::void_>,boost::python::detail::not_specified,boost::python::detail::not_specified>' being compiled
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========