This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Friend functions


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.

--


//*David Sveningsson [eXt]*


Freelance coder | Game Development Student
http://sidvind.com

Thou shalt make thy program's purpose and structure clear to thy fellow man by using the One True Brace Style, even if thou likest it not, for thy creativity is better used in solving problems than in creating beautiful new impediments to understanding.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]