* decl.c (xref_tag): Remember early attributes in TYPE_ATTRIBUTES,
not TREE_TYPE.
* semantics.c (finish_class_definition): Adjust.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49380
138bc75d-0d04-0410-961f-
82ee72b054a4
2002-01-31 Jason Merrill <jason@redhat.com>
+ PR c++/3395
+ * decl.c (xref_tag): Remember early attributes in TYPE_ATTRIBUTES,
+ not TREE_TYPE.
+ * semantics.c (finish_class_definition): Adjust.
+
Allow attributes in parms and casts.
* parse.y (named_parm): Don't strip attrs.
(declmods): Remove 'attributes' production.
CLASSTYPE_DECLARED_CLASS (ref) = 0;
}
- TREE_TYPE (ref) = attributes;
+ TYPE_ATTRIBUTES (ref) = attributes;
return ref;
}
/* If we got any attributes in class_head, xref_tag will stick them in
TREE_TYPE of the type. Grab them now. */
- attributes = chainon (TREE_TYPE (t), attributes);
- TREE_TYPE (t) = NULL_TREE;
+ attributes = chainon (TYPE_ATTRIBUTES (t), attributes);
+ TYPE_ATTRIBUTES (t) = NULL_TREE;
if (TREE_CODE (t) == ENUMERAL_TYPE)
;
--- /dev/null
+// Test that an early attribute doesn't confuse uses of a class.
+// { dg-do compile }
+
+struct __attribute__ ((packed)) A
+{
+ void f () const;
+};
+
+void
+A::f () const
+{
+}