* tree.c (build_cplus_array_type): Also add TYPE_CANONICAL
to the list of variants.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@189588
138bc75d-0d04-0410-961f-
82ee72b054a4
2012-07-17 Jason Merrill <jason@redhat.com>
2012-07-17 Jason Merrill <jason@redhat.com>
+ PR c++/53989
+ * tree.c (build_cplus_array_type): Also add TYPE_CANONICAL
+ to the list of variants.
+
+2012-07-17 Jason Merrill <jason@redhat.com>
+
PR c++/53549
* parser.c (cp_parser_class_head): Call xref_basetypes here.
(cp_parser_class_specifier_1): Not here.
PR c++/53549
* parser.c (cp_parser_class_head): Call xref_basetypes here.
(cp_parser_class_specifier_1): Not here.
{
tree m = build_cplus_array_type (TYPE_MAIN_VARIANT (elt_type),
index_type);
{
tree m = build_cplus_array_type (TYPE_MAIN_VARIANT (elt_type),
index_type);
+ tree c = TYPE_CANONICAL (t);
+
if (TYPE_MAIN_VARIANT (t) != m)
{
TYPE_MAIN_VARIANT (t) = m;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
TYPE_NEXT_VARIANT (m) = t;
}
if (TYPE_MAIN_VARIANT (t) != m)
{
TYPE_MAIN_VARIANT (t) = m;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
TYPE_NEXT_VARIANT (m) = t;
}
+
+ /* If we built a new array type for TYPE_CANONICAL, add
+ that to the list of variants as well. */
+ if (c && c != t && TYPE_MAIN_VARIANT (c) != m)
+ {
+ TYPE_MAIN_VARIANT (c) = m;
+ TYPE_NEXT_VARIANT (c) = t;
+ TYPE_NEXT_VARIANT (m) = c;
+ }
}
/* Push these needs up so that initialization takes place
}
/* Push these needs up so that initialization takes place
2012-07-17 Jason Merrill <jason@redhat.com>
2012-07-17 Jason Merrill <jason@redhat.com>
+ PR c++/53989
+ * g++.dg/template/array23.C: New.
+
+2012-07-17 Jason Merrill <jason@redhat.com>
+
PR c++/53549
* g++.dg/template/current-inst1.C: New.
* g++.dg/parse/crash35.C: Adjust.
PR c++/53549
* g++.dg/template/current-inst1.C: New.
* g++.dg/parse/crash35.C: Adjust.
--- /dev/null
+// PR c++/53989
+
+struct Foo {
+ int value;
+ typedef Foo Foo2;
+ static Foo2 const foos[2];
+};
+
+template <class T> void g (T);
+void bar() {
+ g(&Foo::foos);
+}