Bug in VC4.2 template support: is there VC4.2.1 ??? 
Author Message
 Bug in VC4.2 template support: is there VC4.2.1 ???


I have found a {*filter*} bug from MS VC 4.2. template support: if name of a
template is abc and another template is defined after and it contains a method
called abc, then the compiler thinks that the 'abc' is a template, not a
method. The same code compiles correctly with Sun, Microtec and Gnu

Is there any newer version of the compiler available (e.g. 4.2.1). I know
that VC 5.0 is available, but it works only in Windows NT 4.0 and I am using

The following file demonstrates the problem.


Jukka Kemppainen

// this file demonstrates problem with template support of MS VC 4.2 compiler
// The file compiles without errors with following compilers:
// 1) Sun C++ compiler       : CC setbug.cpp
// 2) Microtec C++ compiler  : ccc68k setbug.cpp
// 3) GNU C++ compiler       : gcc setbug.cpp
// The MS VC 4.2 produces following error messages:
// [c:\]cl setbug.cpp
// Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 10.20.6166 for 80x86
// Copyright (C) Microsoft Corp 1984-1996. All rights reserved.
// setbug.cpp
// setbug.cpp(31) : error C2955: 'set' : class template name expecting
// parameter list
// setbug.cpp(31) : error C2027: use of undefined type
// 'mytemplate<`template-parameter-1'>'
// setbug.cpp(34) : error C2997: 'set' : function parameter list must use
// template parameter 'T'

template <class Key, class Compare>
class set {


template <class T>
class mytemplate
    void set( int data );


template <class T> // line #31
void mytemplate<T>::set( int data )

} // line #34

int main()
        mytemplate<int> x;
        return 0;

Sat, 16 Oct 1999 03:00:00 GMT  
 Bug in VC4.2 template support: is there VC4.2.1 ???

There is no update to 4.2, except to get 5.0

The workaround to the problem is to move the definition of the function
to be inside the class declaration.

FWIW - the code compiles cleanly in VC++ 5.0

Sat, 16 Oct 1999 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. vc4.0 to vc4.2

2. error linking to VC4.2 dll under VC4.1

3. installing vc2.0, vc4.0 and vc4.2b

4. Updating vc4.1 to vc4.2

5. Microsoft Support - VC4 vs VC5

6. Does VC4.2 Support 16bit DDE functions?

7. Serious Optimizer Bug in VC4.0/4.2

8. BUGs in vc4.2 with NT35.1

9. BUG in VC4.2 DEBUGGER w/ OCXs and PulseEvent


11. inet.dll, Service Packs for VC4.0, Bug fixes...GPF

12. VC4.0 BUG? stdin/MSVCRT40.dll problem


Powered by phpBB® Forum Software