Commit e6c2fc5d by Dodji Seketeli Committed by Dodji Seketeli

Patch PR c++/45200

    Fix PR c++/45200, c++/45293, c++/45558

gcc/cp/Changelog:
	PR c++/45200
	PR c++/45293
	PR c++/45558
	* tree.c (strip_typedefs): Strip typedefs from the context of
	TYPENAME_TYPEs.

gcc/testsuite/ChangeLog:
	PR c++/45200
	PR c++/45293
	PR c++/45558
	* g++.dg/template/typedef34.C: New test.
	* g++.dg/template/typedef35.C: New test.

From-SVN: r163929
parent 3c7ac37e
2010-09-06 Dodji Seketeli <dodji@redhat.com>
PR c++/45200
PR c++/45293
PR c++/45558
* tree.c (strip_typedefs): Strip typedefs from the context of
TYPENAME_TYPEs.
2010-09-06 Mark Mitchell <mark@codesourcery.com>
* typeck.c (cp_build_binary_op): Call do_warn_double_promotion.
......
......@@ -1047,6 +1047,11 @@ strip_typedefs (tree t)
TYPE_RAISES_EXCEPTIONS (t));
}
break;
case TYPENAME_TYPE:
result = make_typename_type (strip_typedefs (TYPE_CONTEXT (t)),
TYPENAME_TYPE_FULLNAME (t),
typename_type, tf_none);
break;
default:
break;
}
......
......@@ -1220,7 +1220,7 @@ incompatible_dependent_types_p (tree t1, tree t2)
if (!t1_typedef_variant_p || !t2_typedef_variant_p)
/* Either T1 or T2 is not a typedef so we cannot compare the
the template parms of the typedefs of T1 and T2.
template parms of the typedefs of T1 and T2.
At this point, if the main variant type of T1 and T2 are equal
it means the two types can't be incompatible, from the perspective
of this function. */
......
2010-09-06 Dodji Seketeli <dodji@redhat.com>
PR c++/45200
PR c++/45293
PR c++/45558
* g++.dg/template/typedef34.C: New test.
* g++.dg/template/typedef35.C: New test.
2010-09-06 Uros Bizjak <ubizjak@gmail.com>
PR target/22152
......
// Origin PR c++/45200
// { dg-do compile }
template<typename T>
struct remove_reference
{
typedef T type;
};
template<typename TestType>
struct forward_as_lref
{
};
template<typename Seq, typename N>
struct apply1
{
typedef typename remove_reference<Seq>::type seq;
typedef forward_as_lref<typename seq::seq_type> type; //#0
};
template<typename Seq>
struct apply
{
typedef forward_as_lref<typename remove_reference<Seq>::type::seq_type> type; //#1
};
struct reverse_view
{
typedef int seq_type;
};
int
main()
{
apply<reverse_view >::type a2;
}
// Origin c++/45558
// { dg-do compile }
template <typename S, typename T>
struct C
{
template <typename U>
struct B
{
template <typename W>
struct E
{
explicit E(const W &x) : w(x) {}
const W &w;
};
};
};
struct F;
template <typename X>
struct D
{
D() {}
};
const D<F> g;
template <typename S, typename T>
struct A
{
template <typename U>
struct B : C<S, T>::template B<U>
{
typedef typename C<S, T>::template B<U> V;
static const D<typename V::template E<D<F> > > a;
};
};
template <typename S, typename T>
template <typename U>
const D<typename C<S, T>::template B<U>::template E<D<F> > >
A<S, T>::B<U>::a = typename C<S, T>::template B<U>::template E<D<F> >(g);
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