From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29115 invoked by alias); 4 Mar 2003 12:36:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 29093 invoked by uid 71); 4 Mar 2003 12:36:00 -0000 Resent-Date: 4 Mar 2003 12:36:00 -0000 Resent-Message-ID: <20030304123600.29092.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, jasonkim@cis.upenn.edu Received: (qmail 24979 invoked by uid 48); 4 Mar 2003 12:26:17 -0000 Message-Id: <20030304122617.24978.qmail@sources.redhat.com> Date: Tue, 04 Mar 2003 12:36:00 -0000 From: jasonkim@cis.upenn.edu Reply-To: jasonkim@cis.upenn.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/9938: bug with nested friend of a nested class of a templated class X-SW-Source: 2003-03/txt/msg00151.txt.bz2 List-Id: >Number: 9938 >Category: c++ >Synopsis: bug with nested friend of a nested class of a templated class >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Tue Mar 04 12:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: jasonkim@cis.upenn.edu >Release: 3.2.2 >Organization: >Environment: Linux (Redhat 7.2) >Description: A templated container class defines a nested class (i.e. iterator), which itself defines an inline friend operator function. gcc 3.2.2 complains that the defined friend operator of the nested class is an abstract method of the nested class! This results in the inability to instantiate the nested class. Note that gcc 2.95.3 correctly compiles the supplied code snippet. >How-To-Repeat: The problem can be seen by simply compiling the supplied code snippet. g++ -c gcc32tst.cc >Fix: move the definition of the offending friend function out of the body of nested class and supply -Wno-non-template-friend >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="gcc32tst.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="gcc32tst.cc" IAp0ZW1wbGF0ZSA8Y2xhc3MgVCwgY2xhc3MgWT4gCmNsYXNzIGNvbnRhaW5lciAgCnsgCnB1Ymxp YzoKICB0eXBlZGVmIGNvbnRhaW5lcjxULFk+IHRoaXNjbGFzczsKICAKICBUICphcnA7CiAgVCAq b2k7CiAgCiAgY2xhc3MgaXRlciB7IAogIHByb3RlY3RlZDoKICAgIHRoaXNjbGFzcyAqcDsKICAg IGludCBpZHg7CiAgcHVibGljOiAgICAKICAgIHZpcnR1YWwgaW5saW5lIGludCBrZXkoKSBjb25z dCB7IHJldHVybiBpZHg7IH0KICAgIGZyaWVuZCBib29sIG9wZXJhdG9yPT0oY29uc3QgaXRlciAm eCwgY29uc3QgaXRlciAmeSkgeyAKICAgICAgcmV0dXJuIFRSVUU7CiAgICB9IAogIH07IAoKICBj bGFzcyBjb25zdF9pdGVyIHsgCiAgcHJvdGVjdGVkOgogICAgY29uc3QgdGhpc2NsYXNzICpwOwog ICAgaW50IGlkeDsKICBwdWJsaWM6CiAgICB2aXJ0dWFsIGlubGluZSBpbnQga2V5KCkgY29uc3Qg eyByZXR1cm4gaWR4OyB9CiAgICBmcmllbmQgYm9vbCBvcGVyYXRvcj09KGNvbnN0IGNvbnN0X2l0 ZXIgJngsIGNvbnN0IGNvbnN0X2l0ZXIgJnkpIHsgCiAgICAgIHJldHVybiBUUlVFOwogICAgfSAK ICB9OwoKICB2aXJ0dWFsIGlubGluZSBib29sIGluc2VydChjb25zdF9pdGVyIGl0LCBUICppdGVt KSB7CiAgICBhcnBbaXQua2V5KCldID0gKml0ZW07CiAgfQogIAp9OyAKCmludCBtYWluKCkKewog IGNvbnRhaW5lcjxpbnQsdm9pZD4gYzsKICBjb250YWluZXI8ZmxvYXQsdm9pZD4gZDsKICBjb250 YWluZXI8Y29udGFpbmVyPGludCx2b2lkPix2b2lkID4gZTsKICAKfQo=