【问题标题】:Boost Fusion compile error in VS 2013 RCVS 2013 RC 中的 Boost Fusion 编译错误
【发布时间】:2013-09-18 17:30:24
【问题描述】:

您好,我从trunk 获得了最新的Boost,它使用VS 2013 RC 构建。内置 boost,它起作用了。

但是在针对 Boost 编译我的项目时,我使用了 Boost Fusion。我收到了 100 条这样的错误消息--

错误 1086 错误 C3520: 'T' : 参数包必须在此上下文中展开

参考make_vector10.hpp中的这段代码

namespace result_of
{
    template <typename T0 , typename T1 , typename T2>
    struct make_vector<T0 , T1 , T2>
    {
        typedef vector3<typename detail::as_fusion_element<T0>::type , typename detail::as_fusion_element<T1>::type , typename detail::as_fusion_element<T2>::type> type;
    };
}

但是这里没有使用模板参数“T”。

这也不是可变参数模板,所以我不明白为什么它在错误消息中引用参数包。 "vector3" 和 "as_fusion_element" 也不是可变参数。

make_vector 的所有变体都给我同样的错误顺便说一句(还有 make_set)。

有人知道这里发生了什么吗?谢谢

这是一个最小的复制

#include <boost/fusion/container.hpp> 
#include <boost/fusion/algorithm.hpp> 
#include <boost/fusion/include/algorithm.hpp>           
#include <boost/fusion/sequence.hpp> 
#include <boost/fusion/include/sequence.hpp> 
#include <boost/fusion/support/pair.hpp> 
#include <boost/fusion/include/pair.hpp>

namespace fs = boost::fusion;

namespace Key {

 struct prep_table{}; struct draw_single{};

};

int main() {

fs::map<std::pair<Key::prep_table, float>, std::pair<Key::draw_single, int>> Blah;

return 0;

}

【问题讨论】:

  • 我怀疑这会有所帮助,但您可以尝试在包含任何融合标头之前使用#define BOOST_RESULT_OF_USE_TR1。您也可以尝试#define BOOST_RESULT_OF_USE_DECLTYPE,但我猜这是默认设置。 (我无法访问 Visual Studio,所以很遗憾我无法检查它是否有效)。
  • 谢谢,我试过了,但没有成功。我将 fusion 恢复到不使用任何可变参数模板的旧版本,以便我可以编译我的项目。 VS 吐出的错误消息是无用的,只是没有包含足够的信息来查明真正的问题所在。
  • 我遇到了同样的问题,我得到 MS 的确认这是一个错误:connect.microsoft.com/VisualStudio/feedback/details/811306/… 并将在下一次更新中修复
  • 感谢 MSVC 错误的链接!我在使用 Visual Studio Pro 2013 Update 1 时遇到了这个问题。错误报告没有指出何时可以提供修复。有人知道更多信息吗?

标签: c++ visual-c++ boost visual-studio-2013 boost-fusion


【解决方案1】:

Felix Petroconi 在 cmets 中报告的是 compiler bug

解决方法:获得最新的提升,但将融合回滚到早期版本

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-20
    • 2014-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多