diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-10-03 22:50:59 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-10-03 22:50:59 +0000 |
commit | 2765f897251f68fa66b4a115a84f431d5402d88a (patch) | |
tree | 632ec45b1b3a83b404fb65ccd1659df4baecd037 /gcc/cp | |
parent | d9d60b6febd92c2a51793a747e1544ec172347a4 (diff) | |
download | gcc-2765f897251f68fa66b4a115a84f431d5402d88a.zip gcc-2765f897251f68fa66b4a115a84f431d5402d88a.tar.gz gcc-2765f897251f68fa66b4a115a84f431d5402d88a.tar.bz2 |
re PR c++/58584 ([c++11] ICE with invalid argument for alignas)
/cp
2013-10-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58584
* decl2.c (save_template_attributes): Handle error_mark_node as
*attr_p argument.
(cp_check_const_attributes): Likewise for attributes.
* parser.c (cp_parser_std_attribute_spec): When alignas_expr is an
error_mark_node call cp_parser_skip_to_end_of_statement.
/testsuite
2013-10-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58584
* g++.dg/cpp0x/gen-attrs-55.C: New.
From-SVN: r203193
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 11 | ||||
-rw-r--r-- | gcc/cp/parser.c | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cd75094..f618475 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2013-10-04 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/58584 + * decl2.c (save_template_attributes): Handle error_mark_node as + *attr_p argument. + (cp_check_const_attributes): Likewise for attributes. + * parser.c (cp_parser_std_attribute_spec): When alignas_expr is an + error_mark_node call cp_parser_skip_to_end_of_statement. + 2013-10-03 Easwaran Raman <eraman@google.com> PR c++/33911 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4ac9445..53e6bc9 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1218,10 +1218,12 @@ splice_template_attributes (tree *attr_p, tree decl) static void save_template_attributes (tree *attr_p, tree *decl_p) { - tree late_attrs = splice_template_attributes (attr_p, *decl_p); tree *q; - tree old_attrs = NULL_TREE; + if (attr_p && *attr_p == error_mark_node) + return; + + tree late_attrs = splice_template_attributes (attr_p, *decl_p); if (!late_attrs) return; @@ -1230,7 +1232,7 @@ save_template_attributes (tree *attr_p, tree *decl_p) else q = &TYPE_ATTRIBUTES (*decl_p); - old_attrs = *q; + tree old_attrs = *q; /* Merge the late attributes at the beginning with the attribute list. */ @@ -1318,6 +1320,9 @@ cp_reconstruct_complex_type (tree type, tree bottom) static void cp_check_const_attributes (tree attributes) { + if (attributes == error_mark_node) + return; + tree attr; for (attr = attributes; attr; attr = TREE_CHAIN (attr)) { diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 42b4e60..1a9d6b9 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -21458,6 +21458,8 @@ cp_parser_std_attribute_spec (cp_parser *parser) alignas_expr = cp_parser_assignment_expression (parser, /*cast_p=*/false, /**cp_id_kind=*/NULL); + if (alignas_expr == error_mark_node) + cp_parser_skip_to_end_of_statement (parser); if (alignas_expr == NULL_TREE || alignas_expr == error_mark_node) return alignas_expr; |