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 20:06:00 -0000	[thread overview]
Message-ID: <20030203200600.32336.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: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Subject: Re: c++/9549: [3.4 regression] [New parser] ICE in regenerate_decl_from_template
Date: Mon, 03 Feb 2003 12:55:36 -0700

 Wolfgang Bangerth wrote:
 ...
 >=20
 >=20
 > I understand the reasoning for the necessity of the "template" keyword=20
 > here.
 >=20
 > This is 14.2.4 text and example from the 1997 draft I use:
 >   When  the name of a member template specialization appears after .  o=
 r
 >   -> in a postfix-expression, or after :: in a qualified-id that explic=
 -
 >   itly  depends on a template-argument (_temp.dep_), the member templat=
 e
 >   name must be prefixed by the keyword template.  Otherwise the name  i=
 s
 >   assumed to name a non-template.  [Example:
 >           class X {
 >           public:
 >                   template<size_t> X* alloc();
 >           };
 >           void f(X* p)
 >           {
 >                   X* p1 =3D p->alloc<200>();
 >                           // ill-formed: < means less than
 >=20
 >                   X* p2 =3D p->template alloc<200>();
 >                           // fine: < starts explicit qualification
 >           }
 >    --end example]
 >=20
 > Clearly, the lhs is not template-dependent. Has this been changed=20
 > afterwards? That might explain our mismatch!?
 
 I believe so. Here's what's in the final text:
 
    -4-  When the name of a member template specialization
         appears after . or =AD> in a postfix-expression, or after
         nested-name-specifier in a qualified-id, and the
         postfix-expression or qualified-id explicitly depends on
         a template-parameter (14.6.2), the member template name
         must be prefixed by the keyword template.
         Otherwise the name is assumed to name a non-template.
         [Example:
 
 class X {
 public:
      template<size_t> X* alloc();
      template<size_t> static X* adjust();
 };
 
 template<class T> void f(T* p)
 {
      T* p1 =3D p->alloc<200>();
      // ill-formed: < means less than
 
      T* p2 =3D p->template alloc<200>();
      // OK: < starts template argument list
 
      T::adjust<100>();
      // ill-formed: < means less than
 
      T::template adjust<100>();
      // OK: < starts explicit qualification
 }
 
 --end example]
 
 
 Martin
 


             reply	other threads:[~2003-02-03 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-03 20:06 Martin Sebor [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-05-01 19:00 giovannibajo
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:46 Martin Sebor
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=20030203200600.32336.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: link
Be 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).