
VC++ 5.0 vs 4.2 - New Error
See single line insertion below.
VC4 was allowing some illegal constructs due to
its late processing of template definitions.
--
-- Larry Brasfield
The aforementioned views are mine alone.
Quote:
> The following program fragment demonstrates a construct that we are using
> in a larger program. Under VC++ 4.2, this compiles just fine. Under VC++
> 5.0, however, I get several errors. If this was a non-template class, I
> could resolve everything by inserting "class DEFG;" as the first line of
> the program. But this is a template and I can't do it. Does anyone have
> any ideas? Thanks in advance.
> Gary
> *** BEGIN PROGRAM FRAGEMENT ***
template <typename T> class DEFG; // forward declare templated class
Quote:
> template <class T>
> class ABCD
> {
> class DEFG<T> * q; // VC++ 5.0 errors on this line, but 4.2 is OK
> };
> template <class S>
> class DEFG
> {
> friend class ABCD<S>;
> };
> int WinMain(long hInstance, long hPrevInstance, char * lpCmdLine, int
> nCmdShow)
> {
> return 0;
> }