This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
compilation error with named operator
- From: "Kai Henning" <kai_henning at web dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 28 Jul 2011 14:19:30 +0200 (CEST)
- Subject: compilation error with named operator
- Sensitivity: Normal
Hi folks,
this code compiles fine with VC and Comeau Online, but fail with GCC in every version 4.x on Windows and linux.
Can anyone explain why.
error message from GCC: 'struct FOO' has no member named 'operator FOO2<T>::type'
struct FOO
{
ÂÂÂ operator int() constÂÂÂÂÂÂÂÂÂÂÂ { return static_cast< int >(7); }
ÂÂÂ operator double() constÂÂÂÂÂÂÂÂ { return static_cast< double >(7); }
};
template < typename T >
struct FOO2
{
ÂÂÂ typedef TÂÂÂÂÂÂ type;
ÂÂÂ operator type() constÂÂÂÂÂÂÂÂÂÂ { return t->operator type(); }
private:
ÂÂÂ FOO* t;
};
int main()
{
ÂÂÂ FOO2< int > foo2; foo2.operator int();
ÂÂÂ return 1;
}
Kai
___________________________________________________________
Schon gehÃrt? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar