diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-01-31 22:52:11 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-01-31 22:52:11 +0000 |
commit | 886e875c662de165526b00a3c7d31826b44c41b8 (patch) | |
tree | edd430ad80c9fd93378d6bfbf1d4aafb1636bf1c | |
parent | ed35b400051644eeb1223c7807ee88b5c71c5251 (diff) | |
download | gcc-886e875c662de165526b00a3c7d31826b44c41b8.tar.gz |
PR c++/3395
* 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
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/attrib2.C | 12 |
4 files changed, 20 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f259c96e13a..c73ec0687ca 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e5d1a47e397..a5d9c64767c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12881,7 +12881,7 @@ xref_tag (code_type_node, name, globalize) CLASSTYPE_DECLARED_CLASS (ref) = 0; } - TREE_TYPE (ref) = attributes; + TYPE_ATTRIBUTES (ref) = attributes; return ref; } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 37729bfd967..603326ce9d9 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1891,8 +1891,8 @@ finish_class_definition (t, attributes, semi, pop_scope_p) /* 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) ; diff --git a/gcc/testsuite/g++.dg/ext/attrib2.C b/gcc/testsuite/g++.dg/ext/attrib2.C new file mode 100644 index 00000000000..a7563f3886b --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib2.C @@ -0,0 +1,12 @@ +// 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 +{ +} |