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 2471 invoked by uid 71); 9 Jan 2003 19:16:02 -0000 Resent-Date: 9 Jan 2003 19:16:02 -0000 Resent-Message-ID: <20030109191602.2470.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, bangerth@ticam.utexas.edu Received: (qmail 1844 invoked by uid 61); 9 Jan 2003 19:14:22 -0000 Message-Id: <20030109191422.1843.qmail@sources.redhat.com> Date: Thu, 09 Jan 2003 19:16:00 -0000 From: bangerth@ticam.utexas.edu Reply-To: bangerth@ticam.utexas.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/9252: [3.4 regression][New parser] Errors due to legally used "typename" X-SW-Source: 2003-01/txt/msg00615.txt.bz2 List-Id: >Number: 9252 >Category: c++ >Synopsis: [3.4 regression][New parser] Errors due to legally used "typename" >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Jan 09 11:16:01 PST 2003 >Closed-Date: >Last-Modified: >Originator: Wolfgang Bangerth >Release: unknown-1.0 >Organization: >Environment: 3.4 since new parser merge >Description: This code --------------------------- class O { struct I { I (int); }; template friend typename O::I f (); }; template typename O::I f () { return 1; }; struct X { void g() { f(); } }; ---------------------------------- used to compile until 3.3, but with the new parser I get tmp/g> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.cc x.cc:2: error: `struct O::I' is private x.cc:9: error: within this context x.cc:2: error: `struct O::I' is private x.cc:9: error: within this context The message is clearly wrong, and furthermore goes away if the "typename" is removed in the two places where it is not necessary! Weird, and not very helpful to find the real cause of the problem. On the other hand, Gaby pointed out the right place in the standard that seems to indicate the validity of the use of "typename" here: | > 14.6/5: | > | > The keyword typename shall only be used in template declarations and | > definitions, including in the return type of a function template or | > member function template, in the return type for the definition of a | > member function of a class template or of a class nested within a | > class template, and in the type-specifier for the def-inition of a | > static member of a class template or of a class nested within a | > class template. The keyword typename shall only be applied to | > qualified names, but *those names need not be dependent*. [...] >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: