From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11700 invoked by alias); 29 Mar 2003 01:56:00 -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 11675 invoked by uid 71); 29 Mar 2003 01:56:00 -0000 Resent-Date: 29 Mar 2003 01:56:00 -0000 Resent-Message-ID: <20030329015600.11674.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, bbaetz@acm.org Received: (qmail 11425 invoked from network); 29 Mar 2003 01:55:48 -0000 Received: from unknown (HELO mango.home) (211.28.193.97) by sources.redhat.com with SMTP; 29 Mar 2003 01:55:48 -0000 Received: from mango.home (localhost [127.0.0.1]) by mango.home (8.12.8/8.12.8) with ESMTP id h2T1tkOg013657 for ; Sat, 29 Mar 2003 12:55:46 +1100 Received: (from bbaetz@localhost) by mango.home (8.12.8/8.12.8/Submit) id h2T1tkoF013655; Sat, 29 Mar 2003 12:55:46 +1100 Message-Id: <200303290155.h2T1tkoF013655@mango.home> Date: Sat, 29 Mar 2003 02:36:00 -0000 From: bbaetz@acm.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: c++/10261: g++ does not error for bogus |typename| inside a templated class X-SW-Source: 2003-03/txt/msg02033.txt.bz2 List-Id: >Number: 10261 >Category: c++ >Synopsis: g++ does not error for bogus |typename| inside a templated class >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: accepts-illegal >Submitter-Id: net >Arrival-Date: Sat Mar 29 01:56:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Bradley Baetz >Release: 3.4 20030328 (experimental) >Organization: >Environment: System: Linux mango.home 2.4.18-27.8.0custom #1 Thu Mar 20 20:14:56 EST 2003 i686 i686 i386 GNU/Linux Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --enable-languages=c,c++ --prefix=/home/bbaetz/swtest --program-suffix=-cvs --enable-__cxa_atexit >Description: g++ (3.2 and 3.4-cvs) accepts the use of the |typename| keyword even when the template is explicitly instatiated and does not have dependant parameters, if the use of this occurs from within a template (see example below) I'm not sure that this is a bug. I only have access to the draft c++ standard, but foo::value_type doesn't depend on T, and the |baz| code is accepted without the typename also, even in 3.4. MIPSPro 7.4 appears to disallow both cases, too - see http://bugzilla.mozilla.org/show_bug.cgi?id=199625 (It also disallows |typename| as a function param in a templated class, which I think is incorrect although I'm not sure, so maybe its results should be taken with a grain of salt...) However, this appears to be handled by core issue 183 (http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#183) though, which does make the use of |typename| illegal. >How-To-Repeat: template struct foo { typedef T value_type; }; struct bar { typedef typename foo::value_type t; //errors void xxx(typename foo::value_type); //errors }; template struct baz { typedef typename foo::value_type t; //ok, but should be error void yyy(typename foo::value_type); //ok, but should be error }; >Fix: >Release-Note: >Audit-Trail: >Unformatted: