aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2007-10-22 14:03:10 -0400
committerJason Merrill <jason@gcc.gnu.org>2007-10-22 14:03:10 -0400
commit5818c8e43667f9e256b2d730a9a7d7bf56cbce83 (patch)
tree2d278ce5c068769ddd0d3b21740338eeff8c9022 /gcc
parent22a5d0133dae10ca048e822f180e40cf9400a253 (diff)
downloadgcc-5818c8e43667f9e256b2d730a9a7d7bf56cbce83.zip
gcc-5818c8e43667f9e256b2d730a9a7d7bf56cbce83.tar.gz
gcc-5818c8e43667f9e256b2d730a9a7d7bf56cbce83.tar.bz2
re PR c++/33620 (internal compiler error: canonical types differ for identical types const QList<QStringList> and const QList<QStringList>)
PR c++/33620 * class.c (finish_struct_bits): Copy TYPE_ATTRIBUTES. * pt.c (apply_late_template_attributes): Splice out dependent attributes from DECL_ATTRIBUTES. * decl.c (cxx_maybe_build_cleanup): Use build_address. From-SVN: r129553
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/cp/pt.c46
-rw-r--r--gcc/testsuite/g++.dg/ext/tmplattr7.C11
5 files changed, 59 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4283a88..903db53 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2007-10-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/33620
+ * class.c (finish_struct_bits): Copy TYPE_ATTRIBUTES.
+ * pt.c (apply_late_template_attributes): Splice out dependent
+ attributes from DECL_ATTRIBUTES.
+
+ * decl.c (cxx_maybe_build_cleanup): Use build_address.
+
2007-10-17 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* typeck.c (build_binary_op) : Use appropriate warning option
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 4419813..54dc14c 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1452,6 +1452,9 @@ finish_struct_bits (tree t)
TYPE_VFIELD (variants) = TYPE_VFIELD (t);
TYPE_METHODS (variants) = TYPE_METHODS (t);
TYPE_FIELDS (variants) = TYPE_FIELDS (t);
+
+ /* All variants of a class have the same attributes. */
+ TYPE_ATTRIBUTES (variants) = TYPE_ATTRIBUTES (t);
}
if (BINFO_N_BASE_BINFOS (TYPE_BINFO (t)) && TYPE_POLYMORPHIC_P (t))
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0a42b69..136c8df 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12134,10 +12134,7 @@ cxx_maybe_build_cleanup (tree decl)
if (TREE_CODE (type) == ARRAY_TYPE)
addr = decl;
else
- {
- cxx_mark_addressable (decl);
- addr = build_unary_op (ADDR_EXPR, decl, 0);
- }
+ addr = build_address (decl);
/* Optimize for space over speed here. */
if (!has_vbases || flag_expensive_optimizations)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 773c104..a54e90d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6488,23 +6488,47 @@ static void
apply_late_template_attributes (tree *decl_p, tree attributes, int attr_flags,
tree args, tsubst_flags_t complain, tree in_decl)
{
- tree late_attrs = NULL_TREE;
+ tree last_dep = NULL_TREE;
tree t;
+ tree *p;
+
+ for (t = attributes; t; t = TREE_CHAIN (t))
+ if (ATTR_IS_DEPENDENT (t))
+ {
+ last_dep = t;
+ attributes = copy_list (attributes);
+ break;
+ }
if (DECL_P (*decl_p))
- DECL_ATTRIBUTES (*decl_p) = attributes;
+ p = &DECL_ATTRIBUTES (*decl_p);
else
- TYPE_ATTRIBUTES (*decl_p) = attributes;
+ p = &TYPE_ATTRIBUTES (*decl_p);
- for (t = attributes; t; t = TREE_CHAIN (t))
- if (ATTR_IS_DEPENDENT (t))
- late_attrs = tree_cons
- (TREE_PURPOSE (t),
- tsubst_expr (TREE_VALUE (t), args, complain, in_decl,
- /*integral_constant_expression_p=*/false),
- late_attrs);
+ if (last_dep)
+ {
+ tree late_attrs = NULL_TREE;
+ tree *q = &late_attrs;
- cplus_decl_attributes (decl_p, late_attrs, attr_flags);
+ for (*p = attributes; *p; )
+ {
+ t = *p;
+ if (ATTR_IS_DEPENDENT (t))
+ {
+ *p = TREE_CHAIN (t);
+ TREE_CHAIN (t) = NULL_TREE;
+ TREE_VALUE (t)
+ = tsubst_expr (TREE_VALUE (t), args, complain, in_decl,
+ /*integral_constant_expression_p=*/false);
+ *q = t;
+ q = &TREE_CHAIN (t);
+ }
+ else
+ p = &TREE_CHAIN (t);
+ }
+
+ cplus_decl_attributes (decl_p, late_attrs, attr_flags);
+ }
}
tree
diff --git a/gcc/testsuite/g++.dg/ext/tmplattr7.C b/gcc/testsuite/g++.dg/ext/tmplattr7.C
new file mode 100644
index 0000000..ee6c418
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/tmplattr7.C
@@ -0,0 +1,11 @@
+// PR c++/33620
+
+template <typename T>
+struct __attribute__((visibility("default"))) List {};
+
+int bar(List<int> args);
+bool test(const List<int> &);
+
+int i = bar(List<int>());
+
+bool test(const List<int> &) {}