This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
c++ overloading operator question
- To: gcc at gcc dot gnu dot org
- Subject: c++ overloading operator question
- From: Aldy Hernandez <aldyh at redhat dot com>
- Date: 17 Oct 2000 16:47:52 -0400
hi folks.
The following code fails to compile with g++:
class foobar
{
public:
struct hotdog;
hotdog * p;
operator hotdog *();
};
foobar::operator hotdog * () <-- parse error before '*'
{
return p;
}
apparently the c++ front end is evaluating hotdog in the scope outside
of "class foobar". It should be evaluated inside the foobar scope.
cp/parse.y has this:
/* Names here should be looked up in class scope ALSO. */
| operator type_specifier_seq conversion_declarator
{ $$ = grokoptypename ($2.t, $3); }
so at least somebody knew what was _supposed_ to happen.
Are there any g++ experts out there that know what needs to be hacked
on to have this work-- or is support for this already there, but not
working ?!
Thanks.
Aldy