MSVC8的Terse错误消息:有什么方法可以更明确吗?

时间:2010-12-16 11:32:05

标签: c++ visual-c++ visual-studio-2005

我有

Baz<Foo, Bar> blah_blah(Foo const& f, Bar const& b)
{ return Baz<Foo, Bar>(f, b); }

我收到此错误:

error C2893: Failed to specialize function template 'Baz<Foo, Bar> blah_blah(Foo, Bar)'
with the following template arguments:
'ConcreteFoo'
'ConcreteBar'

这绝对没用,可能会花费我很多时间来调查这个问题(涉及的模板非常多毛,而ConcreteFooConcreteBar本身就是毛茸茸的模板)。

我想知道ConcreteFooConcreteBar中缺少什么类型/成员对象/成员函数会阻止Baz模板的实例化。

有没有办法解决Visual C ++ 2005中这种愚蠢的错误报告?

编辑(相关):Baz,ConcreteFoo和ConcreteBar是这样的:

template <typename T, typename U, bool = f(T, U), int = g(T, U), etc>
struct Baz
{ ... }

并且有很多部分专业化。我知道哪一个是从编译器消息中获取的。此外,函数f和g是难看的丑陋元编程的东西,我相信我的问题来自那里:有一个f或g不能产生正确的结果。 ConcreteFoo或ConcreteBar中必定缺少某些类型/静态成员,我不知道哪一个。

另外,我很难抓住项目的相关部分,编写一个侧面项目进行测试,我想要更“内联”的东西。

1 个答案:

答案 0 :(得分:0)

ConcreteFoo和ConcreteBar是模板还是类?你正在尝试的专业化或部分专业化也是如此吗?

很难说我们什么时候看不到完整的失败例子。

顺便说一下,在你责备编译器之前,你是否已经尝试过像comeau tryitout这样的其他编译器上的代码?

相关问题