Friend functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux