Comments
Patch
@@ -2155,6 +2155,9 @@ finish_call_expr (tree fn, VEC(tree,gc) **args, bool disallow_virtual,
if (TREE_CODE (result) == INDIRECT_REF)
result = TREE_OPERAND (result, 0);
gcc_assert (TREE_CODE (result) == CALL_EXPR
+ /* FIXME cp_build_function_call_vec should avoid argument
+ and return transformations like build_over_call does. */
+ || TREE_CODE (result) == TARGET_EXPR
|| TREE_CODE (fn) == PSEUDO_DTOR_EXPR
|| errorcount);
result = build_call_vec (TREE_TYPE (result), orig_fn, orig_args);
new file mode 100644
@@ -0,0 +1,5 @@
+// PR c++/48162
+
+struct A { };
+A (*f)();
+template <class T> void g() { f(); }
My assert that there wouldn't be any more wrappers around the CALL_EXPR was overconfident; cp_build_function_call_vec still does argument conversions and uses build_cxx_call, which calls build_cplus_new to wrap a call returning a class in TARGET_EXPR. That should be fixed, but in the meantime let's not crash. Tested x86_64-pc-linux-gnu, applied to trunk. commit 37e18e28dd51f50d86be4ad48075ee855bc54a13 Author: Jason Merrill <jason@redhat.com> Date: Thu Mar 17 16:10:42 2011 -0400 PR c++/48162 * semantics.c (finish_call_expr): Allow TARGET_EXPR for now.