public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: bbaetz@acm.org To: gcc-gnats@gcc.gnu.org Subject: c++/10261: g++ does not error for bogus |typename| inside a templated class Date: Sat, 29 Mar 2003 02:36:00 -0000 [thread overview] Message-ID: <200303290155.h2T1tkoF013655@mango.home> (raw) >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<int>::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<typename T> struct foo { typedef T value_type; }; struct bar { typedef typename foo<int>::value_type t; //errors void xxx(typename foo<int>::value_type); //errors }; template<typename T> struct baz { typedef typename foo<int>::value_type t; //ok, but should be error void yyy(typename foo<int>::value_type); //ok, but should be error }; >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2003-03-29 1:56 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-29 2:36 bbaetz [this message] 2003-03-29 8:34 Bradley Baetz 2003-04-07 10:36 Giovanni Bajo 2003-04-07 10:56 Bradley Baetz 2003-04-07 11:16 Giovanni Bajo 2003-04-07 11:26 Bradley Baetz 2003-04-07 14:42 bangerth
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=200303290155.h2T1tkoF013655@mango.home \ --to=bbaetz@acm.org \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).