Commit 6cea69fe by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/38577 (ICE: tree check: expected call_expr, have compound_expr in…

re PR c++/38577 (ICE: tree check: expected call_expr, have compound_expr in build_new_method_call, at cp/call.c:6000)

	PR c++/38577
	* call.c (build_new_method_call): Handle call being COMPOUND_EXPR
	or NOP_EXPR.

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

From-SVN: r142842
parent 735baa21
2008-12-19 Jakub Jelinek <jakub@redhat.com>
PR c++/38577
* call.c (build_new_method_call): Handle call being COMPOUND_EXPR
or NOP_EXPR.
2008-12-18 Jakub Jelinek <jakub@redhat.com>
PR c++/38427
......
......@@ -5993,6 +5993,15 @@ build_new_method_call (tree instance, tree fns, tree args,
if (processing_template_decl && call != error_mark_node)
{
bool cast_to_void = false;
if (TREE_CODE (call) == COMPOUND_EXPR)
call = TREE_OPERAND (call, 1);
else if (TREE_CODE (call) == NOP_EXPR)
{
cast_to_void = true;
call = TREE_OPERAND (call, 0);
}
if (TREE_CODE (call) == INDIRECT_REF)
call = TREE_OPERAND (call, 0);
call = (build_min_non_dep_call_list
......@@ -6001,6 +6010,8 @@ build_new_method_call (tree instance, tree fns, tree args,
orig_instance, orig_fns, NULL_TREE),
orig_args));
call = convert_from_reference (call);
if (cast_to_void)
call = build_nop (void_type_node, call);
}
/* Free all the conversions we allocated. */
......
2008-12-19 Jakub Jelinek <jakub@redhat.com>
PR c++/38577
* g++.dg/template/call6.C: New test.
2008-12-19 Janis Johnson <janis187@us.ibm.com>
Revert:
......
// PR c++/38577
// { dg-do compile }
struct A
{
static A *bar ();
};
struct B : public A
{
static void baz ();
};
template <class T>
void foo ()
{
(static_cast<B *> (A::bar ()))->baz ();
}
void
bar ()
{
foo<int> ();
}
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