This is the mail archive of the gcc-bugs@gcc.gnu.org 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


> >>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 
here.

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 {
          public:
                  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!?

W.

-------------------------------------------------------------------------
Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                              www: http://www.ticam.utexas.edu/~bangerth/



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