c++ overloading operator question
Aldy Hernandez
aldyh@redhat.com
Tue Oct 17 13:46:00 GMT 2000
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
More information about the Gcc
mailing list