diff options
author | Jason Merrill <jason@redhat.com> | 2010-10-13 20:50:26 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-10-13 20:50:26 -0400 |
commit | 8943989ddaeb040a72840f92a9654235e77470fd (patch) | |
tree | 283b19d2c2c5d3a03c65074a0f46db161fb0c68e /gcc/cp/class.c | |
parent | b477c9658b9e37d13e8c1978f2932e1821473339 (diff) | |
download | gcc-8943989ddaeb040a72840f92a9654235e77470fd.zip gcc-8943989ddaeb040a72840f92a9654235e77470fd.tar.gz gcc-8943989ddaeb040a72840f92a9654235e77470fd.tar.bz2 |
re PR c++/45984 (ICE: canonical types differ for identical types)
PR c++/45984
* class.c (fixup_attribute_variants): New fn.
* cp-tree.h: Declare it.
* pt.c (instantiate_class_template): Call it.
* semantics.c (begin_class_definition): Call it.
From-SVN: r165443
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b093ce0..f76c2be 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1515,12 +1515,31 @@ fixup_type_variants (tree t) TYPE_VFIELD (variants) = TYPE_VFIELD (t); TYPE_METHODS (variants) = TYPE_METHODS (t); TYPE_FIELDS (variants) = TYPE_FIELDS (t); + } +} + +/* Early variant fixups: we apply attributes at the beginning of the class + definition, and we need to fix up any variants that have already been + made via elaborated-type-specifier so that check_qualified_type works. */ + +void +fixup_attribute_variants (tree t) +{ + tree variants; - /* All variants of a class have the same attributes. */ + if (!t) + return; + + for (variants = TYPE_NEXT_VARIANT (t); + variants; + variants = TYPE_NEXT_VARIANT (variants)) + { + /* These are the two fields that check_qualified_type looks at and + are affected by attributes. */ TYPE_ATTRIBUTES (variants) = TYPE_ATTRIBUTES (t); + TYPE_ALIGN (variants) = TYPE_ALIGN (t); } } - /* Set memoizing fields and bits of T (and its variants) for later use. */ |