aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>2004-02-06 17:24:31 +0000
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>2004-02-06 17:24:31 +0000
commit6c0cc713d27f74aea4642bd4ebfcb72889de734b (patch)
tree168d8f944dc46f86c1fe8adb6ec30253ad7cd7bd
parent3298fd35f7da7f77a0c2b8574f450b2c3ea286bd (diff)
downloadgcc-6c0cc713d27f74aea4642bd4ebfcb72889de734b.zip
gcc-6c0cc713d27f74aea4642bd4ebfcb72889de734b.tar.gz
gcc-6c0cc713d27f74aea4642bd4ebfcb72889de734b.tar.bz2
re PR c++/14028 (Parser accepts invalid unbalanced triangular bracketing.)
PR c++/14028 * parser.c (cp_parser_enclosed_template_argument_list): Emit straight error when terminator can not be found. From-SVN: r77402
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c32
2 files changed, 22 insertions, 16 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 070192a..285fa86 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2003-02-06 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/14028
+ * parser.c (cp_parser_enclosed_template_argument_list): Emit straight
+ error when terminator can not be found.
+
2004-02-05 Kelley Cook <kcook@gcc.gnu.org>
Make-lang.in (po-generated): Delete.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index f52106a..7e259f6 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -1938,8 +1938,8 @@ cp_parser_non_integral_constant_expression (const char *thing)
static void
cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
-{
- tree decl, old_scope;
+{
+ tree decl, old_scope;
/* Try to lookup the identifier. */
old_scope = parser->scope;
parser->scope = scope;
@@ -1948,8 +1948,8 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
/* If the lookup found a template-name, it means that the user forgot
to specify an argument list. Emit an useful error message. */
if (TREE_CODE (decl) == TEMPLATE_DECL)
- error ("invalid use of template-name `%E' without an argument list",
- decl);
+ error ("invalid use of template-name `%E' without an argument list",
+ decl);
else if (!parser->scope)
{
/* Issue an error message. */
@@ -2271,16 +2271,16 @@ cp_parser_skip_to_closing_brace (cp_parser *parser)
static tree
cp_parser_make_typename_type (cp_parser *parser, tree scope, tree id)
-{
- tree result;
- if (TREE_CODE (id) == IDENTIFIER_NODE)
- {
- result = make_typename_type (scope, id, /*complain=*/0);
- if (result == error_mark_node)
- cp_parser_diagnose_invalid_type_name (parser, scope, id);
- return result;
- }
- return make_typename_type (scope, id, tf_error);
+{
+ tree result;
+ if (TREE_CODE (id) == IDENTIFIER_NODE)
+ {
+ result = make_typename_type (scope, id, /*complain=*/0);
+ if (result == error_mark_node)
+ cp_parser_diagnose_invalid_type_name (parser, scope, id);
+ return result;
+ }
+ return make_typename_type (scope, id, tf_error);
}
@@ -14538,8 +14538,8 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser)
cp_lexer_consume_token (parser->lexer);
}
}
- else
- cp_parser_require (parser, CPP_GREATER, "`>'");
+ else if (!cp_parser_require (parser, CPP_GREATER, "`>'"))
+ error ("missing `>' to terminate the template argument list");
/* The `>' token might be a greater-than operator again now. */
parser->greater_than_is_operator_p
= saved_greater_than_is_operator_p;