mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-20 14:39:29 +08:00
re PR c++/3395 (Attribute causes type lookup to fail. Regression.)
PR c++/3395 * decl.c (xref_tag): Remember early attributes in TYPE_ATTRIBUTES, not TREE_TYPE. * semantics.c (finish_class_definition): Adjust. From-SVN: r49380
This commit is contained in:
parent
e2f2e70a94
commit
a588fe25b7
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
;
|
||||
|
12
gcc/testsuite/g++.dg/ext/attrib2.C
Normal file
12
gcc/testsuite/g++.dg/ext/attrib2.C
Normal file
@ -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
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user