aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-09-14 05:44:39 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-09-14 05:44:39 +0000
commita52eb3bc7c904e73e3cbd53c0439b970143064cc (patch)
tree3a332a2f92838c27b7c50c00f897c00a624ad0a5 /gcc/cp
parent869d095e242efc092bb6c009a281ca20ad30abc3 (diff)
downloadgcc-a52eb3bc7c904e73e3cbd53c0439b970143064cc.zip
gcc-a52eb3bc7c904e73e3cbd53c0439b970143064cc.tar.gz
gcc-a52eb3bc7c904e73e3cbd53c0439b970143064cc.tar.bz2
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/parser.c11
2 files changed, 17 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0103201..6d53c93 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,12 @@
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.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 6ac5c71..05f447a 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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. */