static friends

Leo Savernik l.savernik at aon.at
Thu Aug 21 21:15:08 BST 2003


Hello,

Say I have a static function foo(), which needs access to private members of 
class bar, thus declaring:

class bar {
...
friend static void foo();
};

That gives the following error in gcc-2.95.2:

"storage class specifiers invalid in friend function declarations"

An answer to a similar posting to the gcc mailing list said to omit the static 
in the friend declaration. This compiles but issues the warning:

warning: `foo()' was declared `extern' and later `static'

Does this mean foo() is exported as an unresolved external in the resulting 
shared object? I really want to avoid that.

mfg
	Leo





More information about the kfm-devel mailing list