This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Declaration of static friend function
- To: "'Martin v. Loewis'" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Subject: RE: Declaration of static friend function
- From: "Mevorach, Assaf" <assaf dot mevorach at intel dot com>
- Date: Sun, 14 May 2000 23:38:31 -0700
- Cc: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
This one works although it gives a warning:
"cannot declare member function `A_maker::make(int)' to have static linkage"
but again it works
Thank you!
Assaf M.
-----Original Message-----
From: Martin v. Loewis [mailto:martin@loewis.home.cs.tu-berlin.de]
Sent: Sunday, May 14, 2000 8:23 PM
To: assaf.mevorach@intel.com
Cc: gcc@gcc.gnu.org
Subject: Re: Declaration of static friend function
> friend static A* A_maker::make(MachineType mtype); <-- this line
fails
[...]
> "storage class specifiers invalid in friend function declarations"
> Is it true that this version doesn't support static friends ?
> does anyone knows if this feature is supported in the current version
> (2.95.2) ?
GCC does support "static friends", in any version. However, in
standard C++, you don't need to redeclare that the friend function is
static. IOW, remove the "static" from the friend, and your code should
be accepted, and still do what you want.
Hope this helps,
Martin