diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2005-02-01 05:56:08 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2005-02-01 05:56:08 +0000 |
commit | c8a7ed431adf3bbadac565ff67c78d0195143f94 (patch) | |
tree | 41959edd402fc21a4a2cf1568e59e9fdc454395b /gcc | |
parent | 7d793e369d9247bc0f839be7e7516075dea525be (diff) | |
download | gcc-c8a7ed431adf3bbadac565ff67c78d0195143f94.zip gcc-c8a7ed431adf3bbadac565ff67c78d0195143f94.tar.gz gcc-c8a7ed431adf3bbadac565ff67c78d0195143f94.tar.bz2 |
re PR c++/18757 (ICE (on invalid) in get_innermost_template_args)
gcc/cp/ChangeLog:
PR c++/18757
PR c++/19366
PR c++/19499
* parser.c (cp_parser_template_id): Revert 2004-12-09's patch.
Issue an error when creating the template id.
* pt.c (fn_type_unification): Return early if the explicit
template arg list is an error_mark_node.
gcc/testsuite/ChangeLog:
* g++.dg/parse/typename7.C: Adjust error messages.
From-SVN: r94520
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/parser.c | 9 | ||||
-rw-r--r-- | gcc/cp/pt.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/typename7.C | 12 |
5 files changed, 31 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 92cebfa..2aa42c1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2005-02-01 Alexandre Oliva <aoliva@redhat.com> + + PR c++/18757 + PR c++/19366 + PR c++/19499 + * parser.c (cp_parser_template_id): Revert 2004-12-09's patch. + Issue an error when creating the template id. + * pt.c (fn_type_unification): Return early if the explicit + template arg list is an error_mark_node. + 2005-01-31 Mark Mitchell <mark@codesourcery.com> * decl.c (build_enumerator): Do not issue duplicate error messages diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index e5ea069..473d205 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -8514,7 +8514,7 @@ cp_parser_template_id (cp_parser *parser, error messages about problems during instantiation of the template. Do so only if parsing succeeded, otherwise we may silently accept template arguments with syntax errors. */ - if (start_of_id && !cp_parser_error_occurred (parser)) + if (start_of_id) { cp_token *token = cp_lexer_token_at (parser->lexer, start_of_id); @@ -8525,6 +8525,13 @@ cp_parser_template_id (cp_parser *parser, /* Purge all subsequent tokens. */ cp_lexer_purge_tokens_after (parser->lexer, start_of_id); + + /* ??? Can we actually assume that, if template_id == + error_mark_node, we will have issued a diagnostic to the + user, as opposed to simply marking the tentative parse as + failed? */ + if (cp_parser_error_occurred (parser) && template_id != error_mark_node) + error ("parse error in template argument list"); } pop_deferring_access_checks (); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 176e6a3..3252f36 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9123,6 +9123,9 @@ fn_type_unification (tree fn, tree converted_args; bool incomplete; + if (explicit_targs == error_mark_node) + return 1; + converted_args = (coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (fn), explicit_targs, NULL_TREE, tf_none, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b697d41..defd0903 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-02-01 Alexandre Oliva <aoliva@redhat.com> + + * g++.dg/parse/typename7.C: Adjust error messages. + 2005-01-31 Jeff Law <law@redhat.com> * gcc.c-torture/execute/20050131-1.c: New test. diff --git a/gcc/testsuite/g++.dg/parse/typename7.C b/gcc/testsuite/g++.dg/parse/typename7.C index 2119317..56fcc74 100644 --- a/gcc/testsuite/g++.dg/parse/typename7.C +++ b/gcc/testsuite/g++.dg/parse/typename7.C @@ -9,23 +9,23 @@ struct A { template<typename> void foo(int); template<typename T> void bar(T t) { - this->foo<typename T>(t); } // { dg-error "expected" } + this->foo<typename T>(t); } // { dg-error "expected|parse error|no matching" } template<typename T> void bad(T t) { - foo<typename T>(t); } // { dg-error "expected" } + foo<typename T>(t); } // { dg-error "expected|parse error" } }; template <typename T> struct B { void bar(T t) { - A().bar<typename T>(t); } // { dg-error "expected" } + A().bar<typename T>(t); } // { dg-error "expected|parse error|no matching" } void bad(T t) { B<typename T>::bar(t); } // { dg-error "invalid|not a template" } }; void baz() { - A().bar(0); - A().bad(0); - B<int>().bar(0); + A().bar(0); + A().bad(0); + B<int>().bar(0); } |