2004-09-13 Mark Mitchell <mark@codesourcery.com>
+ PR c++/16162
+ * parser.c (cp_parser_id_expression): Correct value for
+ is_declarator.
+ (cp_parser_nested_name_specifier_opt): Look through typenames as
+ necessary.
+ (cp_parser_template_name): Honor check_dependency_p.
+
PR c++/16716
* parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
Robustify.
/*typename_keyword_p=*/false,
check_dependency_p,
/*type_p=*/false,
- /*is_declarator=*/false)
+ declarator_p)
!= NULL_TREE);
/* If there is a nested-name-specifier, then we are looking at
the first qualified-id production. */
might destroy it. */
old_scope = parser->scope;
saved_qualifying_scope = parser->qualifying_scope;
+ /* In a declarator-id like "X<T>::I::Y<T>" we must be able to
+ look up names in "X<T>::I" in order to determine that "Y" is
+ a template. So, if we have a typename at this point, we make
+ an effort to look through it. */
+ if (is_declaration && parser->scope
+ && TREE_CODE (parser->scope) == TYPENAME_TYPE)
+ parser->scope = resolve_typename_type (parser->scope,
+ /*only_current_p=*/false);
/* Parse the qualifying entity. */
new_scope
= cp_parser_class_or_namespace_name (parser,
if (is_declaration
&& !template_keyword_p
&& parser->scope && TYPE_P (parser->scope)
+ && check_dependency_p
&& dependent_type_p (parser->scope)
/* Do not do this for dtors (or ctors), since they never
need the template keyword before their name. */