This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/1821: friend decl. shadows forward decl.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/1821: friend decl. shadows forward decl.
- From: harri at trolltech dot com
- Date: 31 Jan 2001 16:39:17 -0000
- Reply-To: harri at trolltech dot com
>Number: 1821
>Category: c++
>Synopsis: friend decl. shadows forward decl.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Jan 31 08:46:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Harri Porten
>Release: gcc version 2.97 20010131 (experimental)
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
gcc bails out on the attached code with:
test.cpp:8: no type named `B' in `class A'
Moving the forward declaration above the friend declaration
solves the problem. As the two don't refer to each other
I don't see why the order should make a difference, though.
//////////////// test.cpp ////////////////
class A
{
friend void abc();
class B;
};
class A::B
{
};
>How-To-Repeat:
gcc -c test.cpp
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: