diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-09-14 00:29:03 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-09-14 00:29:03 +0000 |
commit | 3590f0a64a649dad84c2819a54226b5faf9fcb50 (patch) | |
tree | 9e8aa45a4505b9e993c796f41e14d74020abf258 /gcc/cp | |
parent | 86620a426faae66239e1f483dabdb900dc8ae051 (diff) | |
download | gcc-3590f0a64a649dad84c2819a54226b5faf9fcb50.zip gcc-3590f0a64a649dad84c2819a54226b5faf9fcb50.tar.gz gcc-3590f0a64a649dad84c2819a54226b5faf9fcb50.tar.bz2 |
re PR c++/16716 (ICE in cp_parser_parse_and_diagnose_invalid_type_name)
PR c++/16716
* parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
Robustify.
PR c++/17327
* pt.c (unify): Add ENUMERAL_TYPE case. Replace sorry with
gcc_unreacable.
PR c++/16716
* g++.dg/parse/crash17.C: New test.
PR c++/17327
* g++.dg/template/enum3.C: New test.
From-SVN: r87467
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/parser.c | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 6 |
3 files changed, 14 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 37f0811..0103201 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2004-09-13 Mark Mitchell <mark@codesourcery.com> + + PR c++/16716 + * parser.c (cp_parser_parse_and_diagnose_invalid_type_name): + Robustify. + + PR c++/17327 + * pt.c (unify): Add ENUMERAL_TYPE case. Replace sorry with + gcc_unreacable. + 2004-09-12 Richard Henderson <rth@redhat.com> PR c++/16254 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0f6821e..6ac5c71 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -2286,13 +2286,10 @@ cp_parser_parse_and_diagnose_invalid_type_name (cp_parser *parser) cp_parser_abort_tentative_parse (parser); return false; } - if (!cp_parser_parse_definitely (parser)) + if (!cp_parser_parse_definitely (parser) + || TREE_CODE (id) != IDENTIFIER_NODE) return false; - /* If we got here, this cannot be a valid variable declaration, thus - the cp_parser_id_expression must have resolved to a plain identifier - node (not a TYPE_DECL or TEMPLATE_ID_EXPR). */ - gcc_assert (TREE_CODE (id) == IDENTIFIER_NODE); /* Emit a diagnostic for the invalid type. */ cp_parser_diagnose_invalid_type_name (parser, parser->scope, id); /* Skip to the end of the declaration; there's no point in diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0a6b773..90efa06 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9975,6 +9975,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) case VECTOR_TYPE: case INTEGER_TYPE: case BOOLEAN_TYPE: + case ENUMERAL_TYPE: case VOID_TYPE: if (TREE_CODE (arg) != TREE_CODE (parm)) return 1; @@ -10136,10 +10137,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) else return 0; } - else - sorry ("use of `%s' in template type unification", - tree_code_name [(int) TREE_CODE (parm)]); - + gcc_unreachable (); return 1; } } |