templates and casting operators
- by Jonathan Swinney
This code compiles in CodeGear 2009 and Visual Studio 2010 but not gcc. Why?
class Foo
{
public:
operator int() const;
template <typename T> T get() const { return this->operator T(); }
};
Foo::operator int() const
{
return 5;
}
The error message is:
test.cpp: In member function `T Foo::get() const':
test.cpp:6: error: 'const class Foo' has no member named 'operator T'