From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17195 invoked by alias); 7 Feb 2003 15:55:05 -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 17176 invoked by uid 48); 7 Feb 2003 15:55:05 -0000 Date: Fri, 07 Feb 2003 15:55:00 -0000 Message-ID: <20030207155505.17175.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, vil@rccp.tsukuba.ac.jp From: bangerth@dealii.org Reply-To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, vil@rccp.tsukuba.ac.jp, gcc-gnats@gcc.gnu.org Subject: Re: c++/9602: [3.2/3.3/3.4 regression] Total confusion about template/friend/virtual/abstract X-SW-Source: 2003-02/txt/msg00351.txt.bz2 List-Id: Old Synopsis: falsely concludes that function defined within class body is virtual and abstract, therefore compiler fails to allow class instantiation with pure virtual function error. New Synopsis: [3.2/3.3/3.4 regression] Total confusion about template/friend/virtual/abstract State-Changed-From-To: feedback->analyzed State-Changed-By: bangerth State-Changed-When: Fri Feb 7 15:55:05 2003 State-Changed-Why: Confirmed. This is a smaller testcase: --------------------------- template struct X { void foo (X); friend void bar () {} }; template void X::foo (X x) {} template struct X; ----------------------------- There seems to be profound confusion within the compiler about something, since it says tmp/g> /home/bangerth/bin/gcc-3.2/bin/gcc -c x.cc x.cc:7: cannot declare parameter `x' to be of type `X' x.cc:7: because the following virtual functions are abstract: x.cc:3: void bar() This is, of course, entirely bogus. It worked with 3.0, but is broken with present 3.2.2, 3.3 and 3.4 branches, so it's a regression. The testcase is so simple that I can't believe that this is something that hasn't come up yet. Hopefully it's simple to fix. From playing around, it seems to have to do with the fact that the friend function is not only declared, but also defined inside the class; it is instantiated at the place of first use, which is where the error is displayed. W. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9602