VC7.1 Problem

  • Thread starter Thread starter Dinesh
  • Start date Start date
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
]
 
Cute bug. I guess the compiler was just trying too hard to get a longer
error message.

-cd
 
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
]


.
 
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
 
Back
Top