From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Received: (qmail 23107 invoked by uid 71); 12 Jan 2003 20:36:00 -0000 Resent-Date: 12 Jan 2003 20:36:00 -0000 Resent-Message-ID: <20030112203600.23106.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, wlandry@ucsd.edu Received: (qmail 21903 invoked by uid 61); 12 Jan 2003 20:33:40 -0000 Message-Id: <20030112203340.21902.qmail@sources.redhat.com> Date: Sun, 12 Jan 2003 20:36:00 -0000 From: wlandry@ucsd.edu Reply-To: wlandry@ucsd.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/9285: REGRESSION: False shadowing of parameters in templates X-SW-Source: 2003-01/txt/msg00762.txt.bz2 List-Id: >Number: 9285 >Category: c++ >Synopsis: REGRESSION: False shadowing of parameters in templates >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Sun Jan 12 12:36:00 PST 2003 >Closed-Date: >Last-Modified: >Originator: wlandry@ucsd.edu >Release: g++ (GCC) 3.4 20030110 (experimental) >Organization: >Environment: i386 Linux >Description: I think this is a compiler bug. I've attached test code to the end of this message. I get the error foo.C: In constructor `Tensor1::Tensor1(T, T)': foo.C:24: error: declaration of `d0' shadows a parameter foo.C:24: error: expected init-declarator foo.C:24: error: expected `,' or `;' It looks like the parser is just getting confused, since there is no parameter to be shadowed. What is interesting is if I create a named variable in the troublesome line Tensor1_constructor foo(data,d0,d1); then it compiles fine. Changing it to typename Tensor1_constructor(data,d0,d1); still gives the error. This works fine with 3.2, so it is definitely a regression. Apparently it also worked fine a little while ago (maybe Jan 1?). FYI, This test case was extracted from the FTensor test suite. The current version of FTensor won't compile with CVS HEAD because of implicit typename problems, but there is a new version that should work fine. ---------------------------------- template class Tensor1; template class Tensor1_constructor; template class Tensor1_constructor { public: Tensor1_constructor(T data[], T d0, T d1) { data[0]=d0; data[1]=d1; } }; template class Tensor1 { T data[Tensor_Dim]; public: Tensor1(T d0, T d1) { Tensor1_constructor(data,d0,d1); } }; >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: