[Bug c++/26543] New: friend class declaration inside class scope ignored
pato101 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Mar 3 10:03:00 GMT 2006
Seems that "class" is ignored at "friend class a" within class definition
scope. This makes some code I have around not to compile. I may perhaps include
a file with all the classes available at the beginning... but it is ugly.
Nowadays I'm using gcc-3.4 instead of gcc-4.x
See below example of code that fails with gcc version >= 4.0
--8<---- demo.cpp, please do g++ -c demo.cpp -----8<--8<
class a;
//class c; // If uncommented, the code compiles. Otherwise it does not!
class b
{
friend class a;
friend class c;
a * aa;
c * cc;
private:
float p;
};
class a {
b bb;
void bp() { float f = bb.p; };
};
class c {
b bb;
void bp() { float f = bb.p; };
};
-->8---- demo.cpp, please do g++ -c demo.cpp ----->8-->8
--
Summary: friend class declaration inside class scope ignored
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pato101 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26543
More information about the Gcc-bugs
mailing list