U
unkstar
I've written a extentable_buffer class, which allows me to acquire
bigger buffer whenever I need. The original version has a conversion
operator to void*, it's enought for that good old time. things changed
later, its used anywhere necessary in the code. and soon, I was bored
up by chained (type*)(void*) conversion. so, I deciede to write a
generic conversion operator, sth like this:
class extentable_buffer
{
public:
template<typename _Ty>
operator _Ty*()
{
return (_Ty*)myBuf;
}
//...ohter member function here
private:
void *myBuf;
};
Here comes the nightmare, our company is still using MSVC6.0 and gcc
2.7.4. the former one give dozens of error message, well, msvc6
dosen't event support partial-specialization, let's ignore it first.
When I attempt to compile this thing with gcc, it suprised me by such
an message:"internal compiler error, please contact us with full error
report. "OMFG..
I've looked up TC++PL for answer, but find nothing exactly about this,
no for, nor against.
what's worst, when I get home, and try these code with my msvc8, it
just works perfect as I expected! this confused me.
what happen? is such a member template conversion operator legal or
not? where can I find the related description in TC++PL?
bigger buffer whenever I need. The original version has a conversion
operator to void*, it's enought for that good old time. things changed
later, its used anywhere necessary in the code. and soon, I was bored
up by chained (type*)(void*) conversion. so, I deciede to write a
generic conversion operator, sth like this:
class extentable_buffer
{
public:
template<typename _Ty>
operator _Ty*()
{
return (_Ty*)myBuf;
}
//...ohter member function here
private:
void *myBuf;
};
Here comes the nightmare, our company is still using MSVC6.0 and gcc
2.7.4. the former one give dozens of error message, well, msvc6
dosen't event support partial-specialization, let's ignore it first.
When I attempt to compile this thing with gcc, it suprised me by such
an message:"internal compiler error, please contact us with full error
report. "OMFG..
I've looked up TC++PL for answer, but find nothing exactly about this,
no for, nor against.
what's worst, when I get home, and try these code with my msvc8, it
just works perfect as I expected! this confused me.
what happen? is such a member template conversion operator legal or
not? where can I find the related description in TC++PL?