D
Dan Plimak
Greetings,
I'm seeing an odd problem while implementing a template user-specified cast
operator for one of my objects which frequently gets static_cast<>ed around.
The following test case demonstrates the problem, producing an Internal
Compiler Error on the line marked. I'm fairly sure this is valid C++, but I
could be wrong. (g++ at least, chows down on this without complaint.)
--- snip ---
#include <stdio.h>
class Foo
{
public:
template <typename _T> operator const _T*() const
{
return static_cast<const _T*>(this);
}
};
class FooX : public Foo
{
};
int main()
{
FooX f;
const FooX *foox = &f;
const Foo *foo = *foox; // boom!
return 0;
}
--- snip ---
Any ways around this would be appreciated, as are beatings around the head
for missing some obvious C++ legalism.
Cheers,
-- Dan
I'm seeing an odd problem while implementing a template user-specified cast
operator for one of my objects which frequently gets static_cast<>ed around.
The following test case demonstrates the problem, producing an Internal
Compiler Error on the line marked. I'm fairly sure this is valid C++, but I
could be wrong. (g++ at least, chows down on this without complaint.)
--- snip ---
#include <stdio.h>
class Foo
{
public:
template <typename _T> operator const _T*() const
{
return static_cast<const _T*>(this);
}
};
class FooX : public Foo
{
};
int main()
{
FooX f;
const FooX *foox = &f;
const Foo *foo = *foox; // boom!
return 0;
}
--- snip ---
Any ways around this would be appreciated, as are beatings around the head
for missing some obvious C++ legalism.
Cheers,
-- Dan