5 msgWhich library contans the malloc object code an...
10 msgwhere is the string literal allocated ? On the ...

Friend functions
\ David Sveningsson (20 Apr 2007)
. \ John Love-Jensen (20 Apr 2007)
. \ Ian Lance Taylor (20 Apr 2007)

4 msgDisabling cache for some data
2 msgcan't find a register in class 'GENERAL_REGS' w...
2 msgProblem compiling C++ code with mipsisa32-elf-g...
2 msgMangled name of c++ symbol as string
2 msgWhen compile gcc a get error 'Undefined symbol:...
1 msgchosing librarie used by gcc and ld in building
1 msgProblem in Makefile for fortran
4 msggcc C++ app: need a double, but gcc converts ba...
1 msgGCC Makefile/Configuration System
5 msginline asm mmx: how to movq from memory to %mmX
3 msgC++ initialization problem with nested construc...
2 msgCompiletime created instances from function.
1 msgCross compiler for ARM with VFP
1 msgchanges between 3.4 and 4.1.2 / Problem with en...
6 msgundefined reference with -pg option
1 msgunknown flag error?
4 msgwarn about function without & or arguments?
Subject:Re: Friend functions
Group:Gcc-help
From:Ian Lance Taylor
Date:20 Apr 2007


David Sveningsson <ext> writes:

> Hi, the following code compiles with GCC 4.0.1 and VC2005 but not GCC 4.1.1.
>
> class Foo {
> friend void friend_func();
> public:
> virtual void func();
> };
>
> void Foo::func(){
> friend_func();
> }
>
> It fails with '"friend_func" was not declared in this scope'. By also
> declaring friend_func outside of class Foo it compiles on all
> platforms but what I wonder is why this changed from GCC 4.0.x and GCC
> 4.1.x. I guess it's intentionally and not a bug.

See the description of the -ffriend-injection option.

Ian


© 2004-2008 readlist.com