This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/9549: [3.4 regression] [New parser] ICE in regenerate_decl_from_template

The following reply was made to PR c++/9549; it has been noted by GNATS.

From: Wolfgang Bangerth <>
To: Martin Sebor <>
Cc:, <>
Subject: Re: c++/9549: [3.4 regression] [New parser] ICE in regenerate_decl_from_template
Date: Mon, 3 Feb 2003 13:46:33 -0600 (CST)

 > >>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, [...]
 I understand the reasoning for the necessity of the "template" keyword 
 This is 14.2.4 text and example from the 1997 draft I use:
   When  the name of a member template specialization appears after .  or
   -> in a postfix-expression, or after :: in a qualified-id that explic-
   itly  depends on a template-argument (_temp.dep_), the member template
   name must be prefixed by the keyword template.  Otherwise the name  is
   assumed to name a non-template.  [Example:
           class X {
                   template<size_t> X* alloc();
           void f(X* p)
                   X* p1 = p->alloc<200>();
                           // ill-formed: < means less than
                   X* p2 = p->template alloc<200>();
                           // fine: < starts explicit qualification
    --end example]
 Clearly, the lhs is not template-dependent. Has this been changed 
 afterwards? That might explain our mismatch!?
 Wolfgang Bangerth             email:  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]