diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-02-03 20:00:47 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-02-03 20:00:47 +0000 |
commit | 4bfb8bbaf6294daa459f1f0d8216796001998afd (patch) | |
tree | 8998fc588fa4811e7aa6f0b5a481a2993a8da7fb /gcc | |
parent | a8f0f22ea9748a6eeb815ca37cfeb71ad92fc1a3 (diff) | |
download | gcc-4bfb8bbaf6294daa459f1f0d8216796001998afd.zip gcc-4bfb8bbaf6294daa459f1f0d8216796001998afd.tar.gz gcc-4bfb8bbaf6294daa459f1f0d8216796001998afd.tar.bz2 |
re PR c++/13950 ([DR176] lookup of dependent base name)
PR c++/13950
* parser.c (cp_parser_class_name): Robustify.
PR c++/13970
* parser.c (cp_parser_cache_group): Do not consume the EOF token.
PR c++/13950
* g++.dg/template/lookup4.C: New test.
PR c++/13970
* g++.dg/parse/error14.C: New test.
From-SVN: r77186
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/error14.C | 22 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/lookup4.C | 6 |
5 files changed, 48 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a4c9c81..7a398cb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2004-02-03 Mark Mitchell <mark@codesourcery.com> + PR c++/13950 + * parser.c (cp_parser_class_name): Robustify. + + PR c++/13970 + * parser.c (cp_parser_cache_group): Do not consume the EOF token. + PR c++/14002 * semantics.c (finish_id_expression): Do not return an IDENTIFIER_NODE when lookup finds a PARM_DECL. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 2857468..4905b94 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11622,8 +11622,11 @@ cp_parser_class_name (cp_parser *parser, /* If this is a typename, create a TYPENAME_TYPE. */ if (typename_p && decl != error_mark_node) - decl = TYPE_NAME (make_typename_type (scope, decl, - /*complain=*/1)); + { + decl = make_typename_type (scope, decl, /*complain=*/1); + if (decl != error_mark_node) + decl = TYPE_NAME (decl); + } /* Check to see that it is really the name of a class. */ if (TREE_CODE (decl) == TEMPLATE_ID_EXPR @@ -15069,11 +15072,11 @@ cp_parser_cache_group (cp_parser *parser, if ((end == CPP_CLOSE_PAREN || depth == 0) && cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) return; - /* Consume the next token. */ - token = cp_lexer_consume_token (parser->lexer); /* If we've reached the end of the file, stop. */ - if (token->type == CPP_EOF) + if (cp_lexer_next_token_is (parser->lexer, CPP_EOF)) return; + /* Consume the next token. */ + token = cp_lexer_consume_token (parser->lexer); /* Add this token to the tokens we are saving. */ cp_token_cache_push_token (cache, token); /* See if it starts a new group. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b08666a..00c0b71 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2004-02-03 Mark Mitchell <mark@codesourcery.com> + PR c++/13950 + * g++.dg/template/lookup4.C: New test. + + PR c++/13970 + * g++.dg/parse/error14.C: New test. + PR c++/14002 * g++.dg/parse/template13.C: New test. diff --git a/gcc/testsuite/g++.dg/parse/error14.C b/gcc/testsuite/g++.dg/parse/error14.C new file mode 100644 index 0000000..4b23045 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error14.C @@ -0,0 +1,22 @@ +// PR c++/13970 + +struct X +{ + template< typename Z > Z Zunc() + { + return Z(); + } + + template< typename Z > void Zinc() + { + } + + void tst() + { + Zunc<int>(); + + Zinc<int>( //); + // } + +}; // { dg-error "" } + diff --git a/gcc/testsuite/g++.dg/template/lookup4.C b/gcc/testsuite/g++.dg/template/lookup4.C new file mode 100644 index 0000000..d640061 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/lookup4.C @@ -0,0 +1,6 @@ +// PR c++/13950 + +template <class T> struct Base {}; +template <class T> struct Derived: public Base<T> { + typename Derived::template Base<double>* p1; // { dg-error "" } +}; |