Commit a52eb3bc by Mark Mitchell Committed by Mark Mitchell

re PR c++/16162 (Rejects valid member-template-definition)

	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++/16162
	* g++.dg/template/decl2.C: New test.

From-SVN: r87483
parent 869d095e
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.
......
......@@ -3053,7 +3053,7 @@ cp_parser_id_expression (cp_parser *parser,
/*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. */
......@@ -3493,6 +3493,14 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser,
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,
......@@ -8671,6 +8679,7 @@ cp_parser_template_name (cp_parser* 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. */
......
2004-09-13 Mark Mitchell <mark@codesourcery.com>
PR c++/16162
* g++.dg/template/decl2.C: New test.
2004-09-13 Bud Davis <bdavis9659@comcast.net>
PR fortran/17090
......
// PR c++/16162
template <int N> struct O {
struct I {
template <typename T> struct II {
void f();
};
};
};
template <int N>
template <typename T>
void O<N>::I::II<T>::f () {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment