From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32375 invoked by alias); 19 Aug 2002 21:06:01 -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 32355 invoked by uid 71); 19 Aug 2002 21:06:01 -0000 Resent-Date: 19 Aug 2002 21:06:01 -0000 Resent-Message-ID: <20020819210601.32354.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, tkarkanis@aw.sgi.com Received: (qmail 29498 invoked by uid 61); 19 Aug 2002 20:57:11 -0000 Message-Id: <20020819205711.29497.qmail@sources.redhat.com> Date: Mon, 19 Aug 2002 15:06:00 -0000 From: tkarkanis@aw.sgi.com Reply-To: tkarkanis@aw.sgi.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/7638: inline friend in template class produces strange error msg X-SW-Source: 2002-08/txt/msg00386.txt.bz2 List-Id: >Number: 7638 >Category: c++ >Synopsis: inline friend in template class produces strange error msg >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Mon Aug 19 14:06:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: tkarkanis@aw.sgi.com >Release: 3.1 >Organization: >Environment: Red Hat Linux 7.3, IA32 >Description: The compiler rejects the input in the attached file. I'm not sure that the input is legal (because it's kind of strange to have an inline definition of a friend function in a template class). I assume it is legal because every other compiler that I tried (IRIX, Solaris, HP-UX) accepts the input. Even if the input is correctly rejected, the error message is incorrect because the friend function is neither virtual nor abstract. lnx-stdbld:~/tmp> g++3 -c ostream.cpp ostream.cpp:19: cannot declare parameter `arg' to be of type `Complex' ostream.cpp:19: because the following virtual functions are abstract: ostream.cpp:7: ostream& operator<<(ostream&, const Complex&) >How-To-Repeat: g++3 -c ostream.cpp >Fix: A workaround is to take the friend function definition out of the class definition. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="ostream.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ostream.cpp" Y2xhc3Mgb3N0cmVhbTsKCnRlbXBsYXRlPHR5cGVuYW1lIEZsb2F0PgpjbGFzcyBDb21wbGV4CnsK ICAgIGZyaWVuZCBvc3RyZWFtJiBvcGVyYXRvcjw8KCBvc3RyZWFtJiBvcywgY29uc3QgQ29tcGxl eCYgYyApCiAgICAgICAgeyByZXR1cm4gb3M7IH0KICAgIAogICAgRmxvYXQgbV9yZSwgbV9pbTsK cHVibGljOgogICAgCiAgICBDb21wbGV4JiBvcGVyYXRvcis9KCBDb21wbGV4ICk7Cn07CgoKdGVt cGxhdGU8dHlwZW5hbWUgRmxvYXQ+CmlubGluZSBDb21wbGV4PEZsb2F0PiYKQ29tcGxleDxGbG9h dD46Om9wZXJhdG9yKz0oIENvbXBsZXggYXJnICkKewogICAgcmV0dXJuICp0aGlzOwp9Cg==