[patch] PR c++/22172
Mark Mitchell
mark@codesourcery.com
Wed Sep 28 21:46:00 GMT 2005
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
More information about the Gcc-patches
mailing list