This is the mail archive of the gcc-patches@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: [patch] PR c++/22172


James A. Morrison wrote:
>  Hi,
> 
>   This patch makes the c++ parser issue and error of typename is used in the
> wrong place.  We used to ICE in this situation.  This patch has been
> bootstrapped and regtested on ia64-linux with no new regressions.  Ok for
> mainline and 4.0.3?

I don't think this is the right fix; I think that code like this:

namespace N {
  typedef int I;
}

template <typename T>
void f() {
  typename N::I i;
}

is valid.  We've got code in cp_parser_elaborated_type_specifier to
handle this:

      if (tag_type == typename_type
	  && TREE_CODE (parser->scope) != NAMESPACE_DECL)
	return cp_parser_make_typename_type (parser, parser->scope,
					     identifier);

I bet we want something like:

  if (TREE_CODE (scope) == NAMESPACE_DECL)
    type = cp_parser_lookup_name (...);
  else
    type = cp_parser_make_typename_type (...);

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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