Неоднозначный вызов при компиляции boost.type_erasure с сообществом VS 2015

Я пытаюсь использовать boost.type_erasure (версия 1.59) на бесплатной функции `Foo» как показано ниже.

#include <boost/type_erasure/any.hpp>
#include <boost/type_erasure/free.hpp>

void Foo(int);

BOOST_TYPE_ERASURE_FREE((HasFoo), Foo, 1)

using Type = boost::type_erasure::any<
HasFoo<void(boost::type_erasure::_self const&)>,
boost::type_erasure::_self const&
>;

void Foo(int) {}

int main() {
Type x{ 1 };
Foo(x);

return 0;
}

Он компилируется в соответствии с моими тестами на coliru с GCC и CLang. Однако сообщество VS 2015 выдает следующее сообщение об ошибке.

Source.cpp
Source.cpp(17): error C2668: 'boost::type_erasure::injectHasFoo<R (const boost::type_erasure::_self &),Base,boost::type_erasure::index_list<0>>::Foo': ambiguous call to overloaded function
with
[
R=void,
Base=boost::type_erasure::any_base<boost::type_erasure::any<HasFoo<void (const boost::type_erasure::_self &)>,boost::type_erasure::_self &&>>
]
Source.cpp(6): note: could be 'void boost::type_erasure::injectHasFoo<R (const boost::type_erasure::_self &),Base,boost::type_erasure::index_list<0>>::Foo(eval_if_c<0,boost::type_erasure::detail::maybe_const_this_param<const boost::type_erasure::_self &,Base>,boost::type_erasure::as_param<Base,const boost::type_erasure::_self &>>::type)' [found using argument-dependent lookup]
with
[
R=void,
Base=boost::type_erasure::any_base<boost::type_erasure::any<HasFoo<void (const boost::type_erasure::_self &)>,boost::type_erasure::_self &&>>
]
Source.cpp(6): note: or       'void boost::type_erasure::injectHasFoo<R (const boost::type_erasure::_self &),Base,boost::type_erasure::index_list<0>>::Foo(eval_if_c<0,boost::type_erasure::detail::maybe_const_this_param<const boost::type_erasure::_self &,Base>,boost::type_erasure::as_param<Base,const boost::type_erasure::_self &>>::type)' [found using argument-dependent lookup]
with
[
R=void,
Base=boost::type_erasure::any_base<boost::type_erasure::any<HasFoo<void (const boost::type_erasure::_self &)>,boost::type_erasure::_self &>>
]
Source.cpp(6): note: or       'void boost::type_erasure::injectHasFoo<R (const boost::type_erasure::_self &),Base,boost::type_erasure::index_list<0>>::Foo(eval_if_c<0,boost::type_erasure::detail::maybe_const_this_param<const boost::type_erasure::_self &,Base>,boost::type_erasure::as_param<Base,const boost::type_erasure::_self &>>::type)' [found using argument-dependent lookup]
with
[
R=void,
Base=boost::type_erasure::any_base<boost::type_erasure::any<HasFoo<void (const boost::type_erasure::_self &)>,boost::type_erasure::_self>>
]
Source.cpp(6): note: or       'void boost::type_erasure::injectHasFoo<R (const boost::type_erasure::_self &),Base,boost::type_erasure::index_list<0>>::Foo(eval_if_c<0,boost::type_erasure::detail::maybe_const_this_param<const boost::type_erasure::_self &,Base>,boost::type_erasure::as_param<Base,const boost::type_erasure::_self &>>::type)' [found using argument-dependent lookup]
with
[
R=void,
Base=boost::type_erasure::any_base<boost::type_erasure::any<HasFoo<void (const boost::type_erasure::_self &)>,const boost::type_erasure::_self &>>
]
Source.cpp(13): note: or       'void Foo(int)'
Source.cpp(17): note: while trying to match the argument list '(Type)'

0

Решение

Согласно ответу из списка рассылки Boost-users, это вызвано ошибкой шаблона variadic в VS. И код компилируется путем определения BOOST_NO_CXX11_VARIADIC_TEMPLATES.

0

Другие решения