re PR c++/43704 (ICE: tree check: accessed elt 2 of tree_vec with 1 elts in tsubst, at cp/pt.c:10074)

Fix PR c++/43704

gcc/cp/ChangeLog:
	PR c++/43704
	* typeck.c (structural_comptypes): Test dependent typedefs
	incompatibility before testing for their main variant based
	equivalence.

gcc/testsuite/ChangeLog:
	PR c++/43704
	* g++.dg/template/typedef32.C: New test.

From-SVN: r158508
This commit is contained in:
Dodji Seketeli 2010-04-19 09:32:16 +00:00 committed by Dodji Seketeli
parent b5aeb3bb3e
commit d38f6bc03e
4 changed files with 63 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2010-04-19 Dodji Seketeli <dodji@redhat.com>
PR c++/43704
* typeck.c (structural_comptypes): Test dependent typedefs
incompatibility before testing for their main variant based
equivalence.
2010-04-19 Jakub Jelinek <jakub@redhat.com>
* cp-tree.h (SCOPED_ENUM_P, UNSCOPED_ENUM_P, SET_SCOPED_ENUM_P): Use

View File

@ -1236,6 +1236,12 @@ structural_comptypes (tree t1, tree t2, int strict)
if (TYPE_FOR_JAVA (t1) != TYPE_FOR_JAVA (t2))
return false;
/* If T1 and T2 are dependent typedefs then check upfront that
the template parameters of their typedef DECLs match before
going down checking their subtypes. */
if (incompatible_dependent_types_p (t1, t2))
return false;
/* Allow for two different type nodes which have essentially the same
definition. Note that we already checked for equality of the type
qualifiers (just above). */
@ -1244,11 +1250,6 @@ structural_comptypes (tree t1, tree t2, int strict)
&& TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
return true;
/* If T1 and T2 are dependent typedefs then check upfront that
the template parameters of their typedef DECLs match before
going down checking their subtypes. */
if (incompatible_dependent_types_p (t1, t2))
return false;
/* Compare the types. Break out if they could be the same. */
switch (TREE_CODE (t1))

View File

@ -1,3 +1,8 @@
2010-04-19 Dodji Seketeli <dodji@redhat.com>
PR c++/43704
* g++.dg/template/typedef32.C: New test.
2010-04-19 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/37027

View File

@ -0,0 +1,45 @@
// Origin: PR c++/43704
// { dg-do compile }
template<typename T2, typename T3>
struct if_
{
typedef T2 type;
};
template<class I1>
struct iterator_restrict_traits
{
};
template<class T>
class matrix
{
class ci {};
class i {};
};
template<class M, class TRI>
struct triangular_adaptor
{
typedef typename if_<typename M::ci,typename M::i>::type ty1;
class iterator2 : iterator_restrict_traits<typename ty1::ic>::iterator_category
{
};
};
template<class M>
struct banded_adaptor
{
typedef typename if_<typename M::ci,typename M::i>::type ty1;
class iterator1 : iterator_restrict_traits<typename ty1::ic>::iterator_category
{
};
};
template<class T>
struct singular_decomposition
{
banded_adaptor<matrix<double> >::iterator1 it1;
};