From ebab3557d084544fe0ab169a6ceb5963dcae3f15 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 4 Apr 2005 23:43:54 +0000 Subject: [PATCH] re PR c++/20679 (Parse error when accessing attributes of an inner class. Enclosing class is template and have methods with the same name.) PR c++/20679 * parser.c (cp_parser_template_name): Fix thinko. PR c++/20679 * g++.dg/template/overload4.C: New test. From-SVN: r97584 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/parser.c | 15 +++++++-------- gcc/testsuite/ChangeLog | 5 +++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 843a07b82338..9a1876d68da6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-04-04 Mark Mitchell + + PR c++/20679 + * parser.c (cp_parser_template_name): Fix thinko. + 2005-04-03 Gabriel Dos Reis PR c++/18644 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d720d0f6e05c..fb0d1e305130 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -8231,6 +8231,8 @@ cp_parser_template_name (cp_parser* parser, ; else { + tree fn = NULL_TREE; + /* The standard does not explicitly indicate whether a name that names a set of overloaded declarations, some of which are templates, is a template-name. However, such a name should @@ -8238,14 +8240,11 @@ cp_parser_template_name (cp_parser* parser, template-id for the overloaded templates. */ fns = BASELINK_P (decl) ? BASELINK_FUNCTIONS (decl) : decl; if (TREE_CODE (fns) == OVERLOAD) - { - tree fn; - - for (fn = fns; fn; fn = OVL_NEXT (fn)) - if (TREE_CODE (OVL_CURRENT (fn)) == TEMPLATE_DECL) - break; - } - else + for (fn = fns; fn; fn = OVL_NEXT (fn)) + if (TREE_CODE (OVL_CURRENT (fn)) == TEMPLATE_DECL) + break; + + if (!fn) { /* Otherwise, the name does not name a template. */ cp_parser_error (parser, "expected template-name"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e85012d7d582..3f265edc037d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-04 Mark Mitchell + + PR c++/20679 + * g++.dg/template/overload4.C: New test. + 2005-04-03 Gabriel Dos Reis PR c++/18644 -- 2.47.2