diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-04-04 19:11:07 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2005-04-04 19:11:07 +0000 |
commit | d58a2b8348d629d857d93297ba944e903d2f7115 (patch) | |
tree | d56abd9253ed40a96a871f0007e1509795bfc66b /gcc | |
parent | b89361c670cc86ff43dcf87de2b293c19b8dce35 (diff) | |
download | gcc-d58a2b8348d629d857d93297ba944e903d2f7115.zip gcc-d58a2b8348d629d857d93297ba944e903d2f7115.tar.gz gcc-d58a2b8348d629d857d93297ba944e903d2f7115.tar.bz2 |
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: r97569
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/parser.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/overload4.C | 20 |
4 files changed, 37 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f38b03d..ac3c3bc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-04-04 Mark Mitchell <mark@codesourcery.com> + + PR c++/20679 + * parser.c (cp_parser_template_name): Fix thinko. + 2005-04-04 Nathan Sidwell <nathan@codesourcery.com> PR c++/20746 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d682f3a..cb1623d6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -8731,6 +8731,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 @@ -8738,16 +8740,13 @@ 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; - for (fn = fns; fn; fn = OVL_NEXT (fn)) - if (TREE_CODE (OVL_CURRENT (fn)) == TEMPLATE_DECL) - break; - } - else + if (!fn) { - /* Otherwise, the name does not name a template. */ + /* The name does not name a template. */ cp_parser_error (parser, "expected template-name"); return error_mark_node; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ddb7ae2..cca0e18 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-04 Mark Mitchell <mark@codesourcery.com> + + PR c++/20679 + * g++.dg/template/overload4.C: New test. + 2005-04-04 Nathan Sidwell <nathan@codesourcery.com> PR c++/20746 diff --git a/gcc/testsuite/g++.dg/template/overload4.C b/gcc/testsuite/g++.dg/template/overload4.C new file mode 100644 index 0000000..1a294eb --- /dev/null +++ b/gcc/testsuite/g++.dg/template/overload4.C @@ -0,0 +1,20 @@ +// PR c++/20679 + +template <class T> +struct foo +{ + struct bar + { + int m; + }; + + void m() const {} + void m() {} + + bool n() const { return b->m < 42; } + + bar *b; +}; + + + |