Commit b55276c8 by Dodji Seketeli Committed by Dodji Seketeli

re PR c++/35405 (Internal compiler error)

gcc/cp/ChangeLog:
2008-11-19  Dodji Seketeli  <dodji@redhat.com>

	PR c++/35405
	* pt.c (lookup_template_class): Check pointers before dereferencing
	  Them.
	* error.c (dump_template_decl): Likewise.

gcc/testsuite/ChangeLog:
2008-11-19  Dodji Seketeli  <dodji@redhat.com>

	PR c++/35405
	* g++.dg/template/crash84.C: New test.

From-SVN: r142022
parent ff367ac9
2008-11-19 Dodji Seketeli <dodji@redhat.com>
PR c++/35405
* pt.c (lookup_template_class): Check pointers before dereferencing
Them.
* error.c (dump_template_decl): Likewise.
2008-11-19 Jason Merrill <jason@redhat.com>
PR c++/36410
......
......@@ -1044,11 +1044,13 @@ dump_template_decl (tree t, int flags)
}
}
if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
if (DECL_TEMPLATE_RESULT (t)
&& TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
dump_type (TREE_TYPE (t),
((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
| (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0)));
else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL)
else if (DECL_TEMPLATE_RESULT (t)
&& TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL)
dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME);
else
{
......
......@@ -5585,6 +5585,7 @@ lookup_template_class (tree d1,
d1 = DECL_NAME (templ);
}
else if (TREE_CODE (d1) == TEMPLATE_DECL
&& DECL_TEMPLATE_RESULT (d1)
&& TREE_CODE (DECL_TEMPLATE_RESULT (d1)) == TYPE_DECL)
{
templ = d1;
......
2008-11-19 Dodji Seketeli <dodji@redhat.com>
PR c++/35405
* g++.dg/template/crash84.C: New test.
2008-11-19 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/pr11832.c: XFAIL even on s390*-*-*.
......
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR c++/35405
// { dg-do compile }
template<typename T> struct a
{
template <template <typename> class C, typename X, C<X>* =0>
struct b // { dg-error "class C' is not a template|is not a valid type" }
{
};
};
void
foo ()
{
a<int> v; // { dg-message "instantiated from here" }
}
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