VC7.1 Problem

D

Dinesh

template <class _CharT> class Error;

class Y
{
public:
Y(const Error<char>& a) {}
};

class X : public Y
{
public:
X(const Error<char>& a) : Y(a) {}
};

int main()
{
jk=10;
}

Why this test case if compiled under MS Visual Studio .Net
2003 C++ Compiler gives unwanted messages? error C2065 is
expected but what about the others?

.../s\stdexc2.c(17) : error C2065: 'jk' : undeclared identifier
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
 
C

Carl Daniel [VC++ MVP]

Cute bug. I guess the compiler was just trying too hard to get a longer
error message.

-cd
 
D

Dinesh

Is there any fix to this?

-dinesh
-----Original Message-----
Cute bug. I guess the compiler was just trying too hard to get a longer
error message.

-cd
template <class _CharT> class Error;

class Y
{
public:
Y(const Error<char>& a) {}
};

class X : public Y
{
public:
X(const Error<char>& a) : Y(a) {}
};

int main()
{
jk=10;
}

Why this test case if compiled under MS Visual Studio .Net
2003 C++ Compiler gives unwanted messages? error C2065 is
expected but what about the others?

../s\stdexc2.c(17) : error C2065: 'jk' : undeclared identifier
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]
../s\stdexc2.c(12) : see reference to class
template instantiation 'Error<_CharT>' being compiled
with
[
_CharT=char
]


.
 
R

Richard Musil

Yeah, I got similar garbage too, mostly when using STLPort with VC7.1. This
looks like some errors/warnings simply trigger it out, irrelevant to actual
problem.
Seems like compiler bug to me (but harmless).
Richard Musil
 

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