开发者

Terse error message with MSVC8: is there any way to be more explicit?

开发者 https://www.devze.com 2023-01-31 10:08 出处:网络
I have Baz<Foo, Bar> blah_blah(Foo const& f, Bar const& b) { return Baz<Foo, Bar>(f, b); }

I have

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

and I get this error:

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

wh开发者_Go百科ich is definitely useless and will likely take me a lot of time investigating the issue (templates involved are quite hairy, and ConcreteFoo and ConcreteBar are themselves hairy templates).

I'd like to know what types/members objects/member functions are missing from ConcreteFoo and ConcreteBar which prevent instantiation of the Baz template.

Is there a way to work around this idiotic error reporting from Visual C++ 2005 ?

EDIT (relevant): Baz, ConcreteFoo and ConcreteBar are like this:

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

and there are quite a few partial specializations. I know which one is taken from the compiler message. Also, the functions f and g are ugly ugly meta programming stuff, and I believe my problem comes from there: there is one of f or g which does not yield the right result. There must be some type / static member missing from either ConcreteFoo or ConcreteBar, and I don't know which one.

Also, it is difficult for me to just grab the relevant parts of the project, and write a side project for testing, I'd like something more "inline".


ConcreteFoo and ConcreteBar are templates or classes? And so is it a specialization or partial-specialization you are trying?

It's difficult to tell when we can't see a full failing example.

By the way have you tried your code on another compiler like comeau tryitout, before you blame the compiler?

0

精彩评论

暂无评论...
验证码 换一张
取 消