From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3621 invoked by alias); 12 Apr 2004 22:54:48 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 3609 invoked by uid 48); 12 Apr 2004 22:54:48 -0000 Date: Tue, 13 Apr 2004 00:02:00 -0000 From: "austern at apple dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20040412225446.14930.austern@apple.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/14930] New: Friend declaration ignored X-Bugzilla-Reason: CC X-SW-Source: 2004-04/txt/msg01033.txt.bz2 List-Id: Here's the code sample: template class Point; template<> class Point { friend class Plane; double v; }; struct Plane { double get(const Point& p); }; double Plane::get(const Point &p) { return p.v; } Compiling this gives an error message: foo.cc: In member function `double Plane::get(constPoint&)': foo.cc:7: error: `double Point::v' is private foo.cc:14: error: within this context I can't find any justification for this error. The only odd thing about this code sample is that the friend declaration is the first time we have encountered the name "Plane", but this is legal. It even appears in one of the examples in clause 11.4 of the standard. Note that this error is very delicate. It goes away in the non-template case and it goes away if we use an impliict instantiation instead of an explicit specialization. -- Summary: Friend declaration ignored Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: austern at apple dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: powerpc-apple-darwin7.3.0 GCC host triplet: powerpc-apple-darwin7.3.0 GCC target triplet: powerpc-apple-darwin7.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14930