Article ID: 142787
Article Last Modified on 7/5/2005
TS<void (*)(float)> pf ;where TS is the name of class template, and pf is the name of the template class being instantiated. You can now instantiate objects of type pf and use them to call functions that accept a float as an argument and return void.
/* Compile options needed: none
*/
#include <iostream.h>
template <class T>
struct TS
{
void TestType(void);
TS(void) { TestType(); }
};
void f(float x)
{
cout << "x = " << x << endl ;
}
template <class T>
void TS<T>::TestType(void)
{
T t;
t(2.2); // this line generates a C1001
}
void main(void)
{
TS<void *(float)> pf; // this line actually causes the error
// Workaround: change the previous line to look like this:
// TS<void (*)(float)> pf ;
}
Additional query words: kbVC400bug 10.0 10.10 10.20
Keywords: kbbug kbfix kbvc500fix kbcompiler KB142787