re PR c++/40780 (ICE in gimplify_conversion)

PR c++/40780
	* gimplify.c (gimplify_conversion): Don't change non-conversions into
	VIEW_CONVERT_EXPR.

	* g++.dg/template/ptrmem19.C: New test.

From-SVN: r149741
This commit is contained in:
Jakub Jelinek 2009-07-17 12:45:40 +02:00 committed by Jakub Jelinek
parent b2a58c49c9
commit b367fd03b4
4 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2009-07-17 Jakub Jelinek <jakub@redhat.com>
PR c++/40780
* gimplify.c (gimplify_conversion): Don't change non-conversions into
VIEW_CONVERT_EXPR.
2009-07-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/40747

View File

@ -1916,7 +1916,7 @@ gimplify_conversion (tree *expr_p)
/* If we have a conversion to a non-register type force the
use of a VIEW_CONVERT_EXPR instead. */
if (!is_gimple_reg_type (TREE_TYPE (*expr_p)))
if (CONVERT_EXPR_P (*expr_p) && !is_gimple_reg_type (TREE_TYPE (*expr_p)))
*expr_p = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p),
TREE_OPERAND (*expr_p, 0));

View File

@ -1,3 +1,8 @@
2009-07-17 Jakub Jelinek <jakub@redhat.com>
PR c++/40780
* g++.dg/template/ptrmem19.C: New test.
2009-07-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/40747

View File

@ -0,0 +1,19 @@
// PR c++/40780
// { dg-do compile }
template <class T1, typename T2, typename T3>
struct A
{
typedef T2 (T1::*m) (T3);
A (m) {}
};
struct B;
struct C
{
void foo (B *);
};
typedef A <C, void, B *> D;
typedef void (C::*E) (B *);
struct F;
typedef void (C::*G) (F);
D d ((E) (G) & C::foo);