aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Martin <simartin@users.sourceforge.net>2008-06-14 05:21:30 +0000
committerSimon Martin <simartin@users.sourceforge.net>2008-06-14 05:21:30 +0000
commit61f1594b66c7b96b25fb53c4af6d487120d90697 (patch)
tree49becebf3f85a8957f6c86b09667c1331cf064cb
parentc23880f627f04fd4dee416ccf9d5dc38ddc680e4 (diff)
gcc/cp/
2008-06-14 Simon Martin <simartin@users.sourceforge.net> PR c++/35320 * decl2.c (grokbitfield): Receive the list of attributes, pass it to grokdeclarator and apply it to the created declaration. * cp-tree.h (grokbitfield): Update prototype. * parser.c (cp_parser_member_declaration): Don't apply the attributes since they are now applied in grokbitfield. Adjusted the call to grokbitfield. (cp_parser_objc_class_ivars): Likewise. gcc/testsuite/ 2008-06-14 Simon Martin <simartin@users.sourceforge.net> PR c++/35320 * g++.dg/parse/bitfield3.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@136778 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl2.c9
-rw-r--r--gcc/cp/parser.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/bitfield3.C9
6 files changed, 38 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 77f1c0c1583..0ff9cf447bb 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,16 @@
2008-06-14 Simon Martin <simartin@users.sourceforge.net>
+ PR c++/35320
+ * decl2.c (grokbitfield): Receive the list of attributes, pass it to
+ grokdeclarator and apply it to the created declaration.
+ * cp-tree.h (grokbitfield): Update prototype.
+ * parser.c (cp_parser_member_declaration): Don't apply the attributes
+ since they are now applied in grokbitfield. Adjusted the call to
+ grokbitfield.
+ (cp_parser_objc_class_ivars): Likewise.
+
+2008-06-14 Simon Martin <simartin@users.sourceforge.net>
+
PR c++/35317
* class.c (type_requires_array_cookie): Do not consider delete[]
operators with an ellipsis as second argument.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 952020ad045..8ad4fe34b9e 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4283,7 +4283,7 @@ extern void check_member_template (tree);
extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *,
tree, bool, tree, tree);
extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *,
- tree);
+ tree, tree);
extern tree cp_reconstruct_complex_type (tree, tree);
extern void cplus_decl_attributes (tree *, tree, int);
extern void finish_anon_union (tree);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 41af32faec4..ca9440f4230 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -914,9 +914,10 @@ grokfield (const cp_declarator *declarator,
tree
grokbitfield (const cp_declarator *declarator,
- cp_decl_specifier_seq *declspecs, tree width)
+ cp_decl_specifier_seq *declspecs, tree width,
+ tree attrlist)
{
- tree value = grokdeclarator (declarator, declspecs, BITFIELD, 0, NULL);
+ tree value = grokdeclarator (declarator, declspecs, BITFIELD, 0, &attrlist);
if (value == error_mark_node)
return NULL_TREE; /* friends went bad. */
@@ -972,6 +973,10 @@ grokbitfield (const cp_declarator *declarator,
}
DECL_IN_AGGR_P (value) = 1;
+
+ if (attrlist)
+ cplus_decl_attributes (&value, attrlist, /*flags=*/0);
+
return value;
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 12d1a2d8ad9..467a603f992 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -15238,9 +15238,8 @@ cp_parser_member_declaration (cp_parser* parser)
sfk_none)
: NULL,
&decl_specifiers,
- width);
- /* Apply the attributes. */
- cplus_decl_attributes (&decl, attributes, /*flags=*/0);
+ width,
+ attributes);
}
else
{
@@ -19150,11 +19149,10 @@ cp_parser_objc_class_ivars (cp_parser* parser)
attributes = chainon (prefix_attributes, attributes);
if (width)
- {
/* Create the bitfield declaration. */
- decl = grokbitfield (declarator, &declspecs, width);
- cplus_decl_attributes (&decl, attributes, /*flags=*/0);
- }
+ decl = grokbitfield (declarator, &declspecs,
+ width,
+ attributes);
else
decl = grokfield (declarator, &declspecs,
NULL_TREE, /*init_const_expr_p=*/false,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c68ba414467..eed09251e96 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-14 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/35320
+ * g++.dg/parse/bitfield3.C: New test.
+
2008-06-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/36538
diff --git a/gcc/testsuite/g++.dg/parse/bitfield3.C b/gcc/testsuite/g++.dg/parse/bitfield3.C
new file mode 100644
index 00000000000..d907dcdd19b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/bitfield3.C
@@ -0,0 +1,9 @@
+/* PR c++/35320 */
+/* { dg-do "compile" } */
+
+typedef void (func_type)();
+
+struct A
+{
+ friend func_type f : 2; /* { dg-error "with non-integral type" } */
+};