This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/26543] New: friend class declaration inside class scope ignored
- From: "pato101 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Mar 2006 10:03:45 -0000
- Subject: [Bug c++/26543] New: friend class declaration inside class scope ignored
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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