+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
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);
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. */
}
DECL_IN_AGGR_P (value) = 1;
+
+ if (attrlist)
+ cplus_decl_attributes (&value, attrlist, /*flags=*/0);
+
return value;
}
sfk_none)
: NULL,
&decl_specifiers,
- width);
- /* Apply the attributes. */
- cplus_decl_attributes (&decl, attributes, /*flags=*/0);
+ width,
+ attributes);
}
else
{
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,
+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
--- /dev/null
+/* PR c++/35320 */
+/* { dg-do "compile" } */
+
+typedef void (func_type)();
+
+struct A
+{
+ friend func_type f : 2; /* { dg-error "with non-integral type" } */
+};