This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug


Hello,
I tried to compile the code sequence below using egcs-2.91.60, which resulted on Internal Compiler Error on the first line in the template member function array.
Basically, I am trying to take the adderss of an instantation of a template member function.
Is there something wrong with my code or is the compiler broken ? Funny enough, VC6.0 also gives Internal Compiler Error on the same line. Furthermore, VC6 crashes also on :
template void A::myfn<char>(char*);
which egcs accepts.
////////////////////////////////////////////////////////////////////////////////
 
template <class T> class B { template <class O> void fn(O*) {}; };
 
class A
{
public:
typedef void (A::*afn)(void);
static afn compute_table[3];
template<class T> void myfn(T*data) { *data += 10;}
};
 
fn()
{
A*t=0;
t->myfn((char*)0);
t->myfn((float*)0);
t->myfn((double*)0);
}
 
template void A::myfn<char>(char*); // ok egcs, crash in vc6
//template void B<char>::fn(char*);
 

A::afn A::compute_table[]=
{
A::myfn<char>,  // crashes both egcs and vc6
&A::myfn<float>, // same here
&A::myfn<double>
};
 
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]