public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Martin Sebor <sebor@roguewave.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c++/9549: [3.4 regression] [New parser] ICE in regenerate_decl_from_template Date: Mon, 03 Feb 2003 19:46:00 -0000 [thread overview] Message-ID: <20030203194600.17531.qmail@sources.redhat.com> (raw) The following reply was made to PR c++/9549; it has been noted by GNATS. From: Martin Sebor <sebor@roguewave.com> To: Wolfgang Bangerth <bangerth@ticam.utexas.edu> Cc: bangerth@dealii.org, gcc-gnats@gcc.gnu.org Subject: Re: c++/9549: [3.4 regression] [New parser] ICE in regenerate_decl_from_template Date: Mon, 03 Feb 2003 12:37:26 -0700 Wolfgang Bangerth wrote: >>> This is not a bug. You need to write >>> m.template do_it<T>(); >> >>This is incorrect, as is your previous analysis in PR #9510: >>http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9510 >> >>This syntax is required only if the right hand side of the ^^^^^^^^^^^^^^^ I meant left hand side here, not right hand side. Sorry. >>dot operator depends on a template parameter, otherwise it >>is optional. Please read 14.2, p4 for more. > > > Ehm, but in m.do_it<T>, the rhs of the dot operator _is_ template > dependent, no? 14.2.4 has almost the same example and says that you need > the template keyword -- what am I missing here? If the left hand side does not depend on a template parameter, there is no reason to use the template prefix since the name to the right of the dot is known to either be a template or not at the point of parsing the "surrounding" template and there is no possibility of an ambiguity with the less than operator. Otherwise it may or may not be a template, and the first "<" may or may not be a less than operator, depending on any specializations of the template to the left of the dot operator. For instance, in the example below, the declaration enum { e = A<I - 1>::B<J - 1>::e + 1 }; is parsed as enum { e = (A<I - 1>::B) < (J - 1) > (::e + 1) }; ^^^^^^^ ^ ^ | | +- operator>() | +- operator<() +-template argument list without the template keword because at the point of definition of the primary template A it's not known whether B is or is not a template. With the template keyword, A<I - 1>::template B<J - 1> would be parsed as the type name of the template B. The same logic applies to the dot operator as well as to operator-> enum { e }; template <int I> struct A { template <int J> struct B { enum { e = A<I - 1>::B<J - 1>::e + 1 }; }; }; template<> struct A<0> { enum { B }; }; int main () { return A<1>::B<1>::e; } Martin
next reply other threads:[~2003-02-03 19:46 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-02-03 19:46 Martin Sebor [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-05-01 19:00 giovannibajo 2003-02-03 20:06 Martin Sebor 2003-02-03 20:06 Wolfgang Bangerth 2003-02-03 19:56 Wolfgang Bangerth 2003-02-03 19:46 Wolfgang Bangerth 2003-02-03 19:36 Gabriel Dos Reis 2003-02-03 19:26 Wolfgang Bangerth 2003-02-03 19:16 Martin Sebor 2003-02-03 19:00 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=20030203194600.17531.qmail@sources.redhat.com \ --to=sebor@roguewave.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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).