Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500.
We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -I<different include paths> -D<differen #define's> X.CPP -oX.O // file X.CPP struct S { static int f4 (); class C { public: C (); ~C (); private: friend int f4 (); static int i; }; }; int f4 () { return S::C::i; } int S::f4 () { return C::i; } // Comeau: member "S::C::i" is inaccessible The code above compiles fine with GNU. Obviously the compiler binds the friend declaration in class C to tow functions: to S::f4() and to ::f4() since both functions can access the private member S::C::i. It is not clear if the friend declaration should link to S::f4(). There is a defect report (DR 138) which covers this case. Kind regards W. Roehrl -- Summary: friend declaration links to two functions Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at de dot gi-de dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20987