Commit 697c474c by Jason Merrill Committed by Jason Merrill

re PR c++/53989 (Internal compiler error in strip_typedefs, at cp/tree.c:1187)

	PR c++/53989
	* tree.c (build_cplus_array_type): Also add TYPE_CANONICAL
	to the list of variants.

From-SVN: r189587
parent 7fe3aa08
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.
* decl.c (xref_basetypes): Complain about incomplete template base. * decl.c (xref_basetypes): Complain about incomplete template base.
* class.c (finish_struct): Adjust variants in templates, too. * class.c (finish_struct): Adjust variants in templates, too.
......
...@@ -803,12 +803,23 @@ build_cplus_array_type (tree elt_type, tree index_type) ...@@ -803,12 +803,23 @@ build_cplus_array_type (tree elt_type, tree index_type)
{ {
tree m = build_cplus_array_type (TYPE_MAIN_VARIANT (elt_type), tree m = build_cplus_array_type (TYPE_MAIN_VARIANT (elt_type),
index_type); index_type);
tree c = TYPE_CANONICAL (t);
if (TYPE_MAIN_VARIANT (t) != m) if (TYPE_MAIN_VARIANT (t) != m)
{ {
TYPE_MAIN_VARIANT (t) = m; TYPE_MAIN_VARIANT (t) = m;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
TYPE_NEXT_VARIANT (m) = t; 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>
PR c++/53989
* g++.dg/template/array23.C: New.
2012-07-17 Tobias Burnus <burnus@net-b.de> 2012-07-17 Tobias Burnus <burnus@net-b.de>
PR fortran/53985 PR fortran/53985
......
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment