From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22350 invoked by alias); 9 Oct 2010 13:38:14 -0000 Received: (qmail 22340 invoked by uid 22791); 9 Oct 2010 13:38:14 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Oct 2010 13:38:10 +0000 From: "MichieldeB at aim dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/45942] class will not get friends with another class X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: MichieldeB at aim dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Sat, 09 Oct 2010 13:38:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-10/txt/msg00795.txt.bz2 Message-ID: <20101009133800.jokiIdm6c7LV08md-p0f6ZvWOr9Kv0McgM_eQ8wKIJ4@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45942 --- Comment #13 from Michiel 2010-10-09 13:38:05 UTC --- The reason that I did not succeed in making ClassB a friend of ClassA is that C++ is not very logical. See below. template class classB; template class classC; template class classA { // classA does NOT become friends with classA friend class classB; // with an extra template argument, this is only possible via // specialization, which is not allowed template <> friend class classB; template friend class classC; // because with your solution, classA (classB) // DOES become friends with classA (classB) template friend class classB; template friend class classC; }; template class classA;