public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/11814] New: Code with missing "template" keyword wrongly accepted Date: Tue, 05 Aug 2003 23:09:00 -0000 [thread overview] Message-ID: <20030805230939.11814.reichelt@gcc.gnu.org> (raw) PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11814 Summary: Code with missing "template" keyword wrongly accepted Product: gcc Version: 3.4 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org Here's a spin-off from PR 6023: The following code snippet is wrongly accepted by gcc: ------------------------------------------- template <typename> struct A { template <typename> void foo(); }; template <typename T> struct B { template <int> void foo() { A<T>* p; p->foo<int>(); // wrong: should be "p->template foo<int>();" } }; ------------------------------------------- Since "p" is dependent on the outer template parameter, we need a "template" here. The parser wrongly accepts it because it finds "foo" in the current scope which happens to be a template (although it's actually the wrong "foo" that is considered for parsing). (This was pointed out by Nathan.) To see this effect, just remove the "template <int>" from the second "foo" and the compiler gioves an error message. This bug affects all versions since gcc 2.95.x.
next reply other threads:[~2003-08-05 23:09 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-08-05 23:09 reichelt at gcc dot gnu dot org [this message] 2003-08-05 23:23 ` [Bug c++/11814] " reichelt at gcc dot gnu dot org 2003-08-05 23:34 ` pinskia at physics dot uc dot edu 2003-08-05 23:36 ` pinskia at physics dot uc dot edu 2003-08-06 0:38 ` pinskia at physics dot uc dot edu 2003-08-08 0:07 ` reichelt at gcc dot gnu dot org 2003-08-23 1:09 ` dhazeghi at yahoo dot com 2003-11-07 16:34 ` reichelt at gcc dot gnu dot org 2003-11-23 11:36 ` lerdsuwa at gcc dot gnu dot org 2004-05-26 11:40 ` pinskia at gcc dot gnu dot org 2004-07-27 16:08 ` lerdsuwa at gcc dot gnu dot org 2005-03-17 13:59 ` pinskia at gcc dot gnu dot org 2005-03-25 20:38 ` redi at gcc dot gnu dot org
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=20030805230939.11814.reichelt@gcc.gnu.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).