From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14365 invoked by alias); 17 Sep 2004 22:07:23 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 14049 invoked from network); 17 Sep 2004 22:07:20 -0000 Received: from unknown (HELO fencepost.gnu.org) (199.232.76.164) by sourceware.org with SMTP; 17 Sep 2004 22:07:20 -0000 Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.34) id 1C8Qsx-0004jQ-Or for gcc@gnu.org; Fri, 17 Sep 2004 18:07:19 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1C8Qsv-0007Hb-Kc for gcc@gnu.org; Fri, 17 Sep 2004 18:07:18 -0400 Received: from [193.180.251.47] (helo=penguin.ericsson.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C8Qsv-0007HY-05 for gcc@gnu.org; Fri, 17 Sep 2004 18:07:17 -0400 Received: from esealmw141.al.sw.ericsson.se ([153.88.254.120]) by penguin.ericsson.se (8.12.10/8.12.10/WIREfire-1.8b) with ESMTP id i8HM7ElU010974 for ; Sat, 18 Sep 2004 00:07:14 +0200 (MEST) Received: from esealnt610.al.sw.ericsson.se ([153.88.254.120]) by esealmw141.al.sw.ericsson.se with Microsoft SMTPSVC(6.0.3790.0); Sat, 18 Sep 2004 00:07:14 +0200 Received: by esealnt610.al.sw.ericsson.se with Internet Mail Service (5.5.2657.72) id ; Sat, 18 Sep 2004 00:07:14 +0200 Message-ID: From: "Johan Bergman (KI/EAB)" To: "'gcc@gnu.org'" Subject: Error on GCC 3.4 release web page Date: Fri, 17 Sep 2004 23:35:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-OriginalArrivalTime: 17 Sep 2004 22:07:14.0024 (UTC) FILETIME=[AFECBE80:01C49D02] X-Spam-Status: No, hits=1.2 required=5.0 tests=MSG_ID_ADDED_BY_MTA_3,RCVD_IN_ORBS version=2.55 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) X-SW-Source: 2004-09/txt/msg01092.txt.bz2 Hi, There seems to be an error in the following example, found on http://gcc.gnu.org/gcc-3.4/changes.html. In a template definition, unqualified names will no longer find members of a dependent base. For example, template struct B { int m; int n; int f (); int g (); }; int n; int g (); template struct C : B { void g () { m = 0; // error f (); // error n = 0; // ::n is modified g (); // ::g is called } }; You must make the names dependent by prefixing them with this->. Here is the corrected definition of C::g, template void C::g () { this->m = 0; this->f (); this->n = 0 this->g (); } The problem with the example is that the member function g() in C calls itself. The following should work better: In a template definition, unqualified names will no longer find members of a dependent base. For example, template struct B { int m; int n; int f (); int g (); }; int n; int g (); template struct C : B { void h () { m = 0; // error f (); // error n = 0; // ::n is modified g (); // ::g is called } }; You must make the names dependent by prefixing them with this->. Here is the corrected definition of C::h, template void C::h () { this->m = 0; this->f (); this->n = 0 this->g (); } My only change was that 'g' was replaced with 'h' in three places (two in the code and one in the text). BR, Johan