Commit 649fb657 by Dodji Seketeli Committed by Dodji Seketeli

re PR c++/41863 (segfault with sizeof in template parameter)

Fix PR c++/41863

gcc/cp/ChangeLog:

	PR c++/41863
	* pt.c (iterative_hash_template_arg): articifial parms
	don't have DECL_PARM_INDEX set. Do not hash it.

gcc/testsuite/ChangeLog:

	PR c++/41863
	* g++.dg/template/sizeof12.C: New test.

From-SVN: r153735
parent 1e43a145
2009-10-30 Dodji Seketeli <dodji@redhat.com>
PR c++/41863
* pt.c (iterative_hash_template_arg): articifial parms
don't have DECL_PARM_INDEX set. Do not hash it.
2009-10-28 Jerry Quinn <jlquinn@optonline.net>
* mangle.c (mangle_type_string_for_rtti): Revert r149964.
......
......@@ -1501,7 +1501,8 @@ iterative_hash_template_arg (tree arg, hashval_t val)
}
case PARM_DECL:
val = iterative_hash_object (DECL_PARM_INDEX (arg), val);
if (!DECL_ARTIFICIAL (arg))
val = iterative_hash_object (DECL_PARM_INDEX (arg), val);
return iterative_hash_template_arg (TREE_TYPE (arg), val);
case TARGET_EXPR:
......
2009-10-30 Dodji Seketeli <dodji@redhat.com>
PR c++/41863
* g++.dg/template/sizeof12.C: New test.
2009-10-29 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/pack14.adb: New test.
......
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR c++/41863
template<int X>
struct Bar
{
};
template<typename T>
class Foo
{
T m_foo;
void
crash()
{
Bar<sizeof(m_foo)> bar;
}
};
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