aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>2006-06-23 17:02:38 +0000
committerVolker Reichelt <reichelt@gcc.gnu.org>2006-06-23 17:02:38 +0000
commit0b9cb8c266252af79b24e3b3609dc450cdd4f9ed (patch)
treef585bfa75f5fb97d8fa3960a27839b602972dd58 /gcc/cp
parente10e3ac826f20ce1ea8560ccc083b4fdb1070eea (diff)
downloadgcc-0b9cb8c266252af79b24e3b3609dc450cdd4f9ed.zip
gcc-0b9cb8c266252af79b24e3b3609dc450cdd4f9ed.tar.gz
gcc-0b9cb8c266252af79b24e3b3609dc450cdd4f9ed.tar.bz2
re PR c++/28112 (ICE with invalid argument in attribute)
PR c++/28112 * parser.c (cp_parser_attribute_list): Skip attributes with invalid arguments. Fix comment. * g++.dg/ext/attrib23.C: New test. From-SVN: r114941
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c21
2 files changed, 16 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2f726bd..76ed3a0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2006-06-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+ PR c++/28112
+ * parser.c (cp_parser_attribute_list): Skip attributes with invalid
+ arguments. Fix comment.
+
PR c++/11468
* init.c (build_new_1): Handle error_mark_nodes returned by
build_java_class_ref.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 5820cb7..deb36fe 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14614,6 +14614,8 @@ cp_parser_attribute_list (cp_parser* parser)
if (token->type == CPP_NAME
|| token->type == CPP_KEYWORD)
{
+ tree arguments = NULL_TREE;
+
/* Consume the token. */
token = cp_lexer_consume_token (parser->lexer);
@@ -14627,18 +14629,19 @@ cp_parser_attribute_list (cp_parser* parser)
/* If it's an `(', then parse the attribute arguments. */
if (token->type == CPP_OPEN_PAREN)
{
- tree arguments;
-
- arguments = (cp_parser_parenthesized_expression_list
- (parser, true, /*cast_p=*/false,
- /*non_constant_p=*/NULL));
- /* Save the identifier and arguments away. */
+ arguments = cp_parser_parenthesized_expression_list
+ (parser, true, /*cast_p=*/false,
+ /*non_constant_p=*/NULL);
+ /* Save the arguments away. */
TREE_VALUE (attribute) = arguments;
}
- /* Add this attribute to the list. */
- TREE_CHAIN (attribute) = attribute_list;
- attribute_list = attribute;
+ if (arguments != error_mark_node)
+ {
+ /* Add this attribute to the list. */
+ TREE_CHAIN (attribute) = attribute_list;
+ attribute_list = attribute;
+ }
token = cp_lexer_peek_token (parser->lexer);
}