This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25784] New: "friend class" forward declaration doesn't actually declare class
- From: "metcalf at lcs dot mit dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jan 2006 15:42:01 -0000
- Subject: [Bug c++/25784] New: "friend class" forward declaration doesn't actually declare class
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In the appended snippet of code, the Foo2 class is only forward-declared in the
context of a "friend" statement ("friend class Foo2"). With gcc 3.2.3 this
sufficed to forward-declare it. With gcc 4.0.2 you must have a forward
declaration without a "friend" qualifier or gcc won't recognize the class type
name when it encounters it later. Compiling this snippet yields "ISO C++
forbids declaration of ?Foo2? with no type".
class Bar {
class Foo1;
friend class Foo1;
friend class Foo2;
Foo1* foo1;
Foo2* foo2;
};
--
Summary: "friend class" forward declaration doesn't actually
declare class
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: metcalf at lcs dot mit dot edu
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25784