BUG VC7.1: well-formed code produces obscure error message

  • Thread starter Maxim Yegorushkin
  • Start date
M

Maxim Yegorushkin

The following code perfectly compilable with Comeau online and gcc 3.2 produces quite an obscure error message when compiled with VC7.1.

namespace N {

struct A
{
template<class F>
void fun(F f);
};

}

template<class F>
void N::A::fun(F f) // (1)
{
f(*this);
}

void g(N::A&);

template<class T> // (2)
struct B : N::A
{
B()
{
this->fun(&::g); // error C2660: 'N::fun' : function does not take 2 arguments
}
};

int main()
{
B<void> b;
}

Please note that the error message mention N::fun function, but there is no one, rather there is N::A::fun.

I've found that I can work around the bug by placing (1) function definition inside namespace N or making B class (2) non template.

Could some competent person comment the situation?
 
D

David Lowndes

The following code perfectly compilable with Comeau online and gcc 3.2 produces quite an obscure error message when compiled with VC7.1.
...
I've found that I can work around the bug by placing (1) function definition inside namespace N or making B class (2) non template.

Could some competent person comment the situation?

I'm afraid I can't qualify as competent in these areas, but as no-one
else appears to have come forward....

I can reproduce the issue and that it compiles cleanly with Comeau
(always a good sign), and as it's still the same in the Whidbey
compiler I've tried to forward your report to MS as a bug against
Whidbey.

Dave
 
M

Maxim Yegorushkin

David said:
I can reproduce the issue and that it compiles cleanly with Comeau
(always a good sign), and as it's still the same in the Whidbey
compiler I've tried to forward your report to MS as a bug against
Whidbey.

Does it mean that they might fix it in upcoming Whidbey only?
 
R

Ronald Laeremans [MSFT]

Yes, it means we are looking to get this fixed in Whidbey.

Ronald Laeremans
Visual C++ team
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top