re PR c++/21123 (ICE in cp_expr_size, at cp/cp-objcp-common.c:101)
authorJason Merrill <jason@redhat.com>
Tue, 8 Nov 2005 08:32:26 +0000 (03:32 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 8 Nov 2005 08:32:26 +0000 (03:32 -0500)
        PR c++/21123
        * cp/method.c (use_thunk): Use build_cplus_new instead of
        force_target_expr.

        * tree.h (CALL_FROM_THUNK_P): Add CALL_EXPR_CHECK.

From-SVN: r106634

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/g++.dg/inherit/thunk4.C [new file with mode: 0644]
gcc/tree.h

index 1e22fd36845138782dcbb7c8123c12f5681deaf0..bd9a3e0450441f3f2de2b53a0625d64933ae2b5a 100644 (file)
@@ -1,3 +1,7 @@
+2005-11-08  Jason Merrill  <jason@redhat.com>
+
+       * tree.h (CALL_FROM_THUNK_P): Add CALL_EXPR_CHECK.
+
 2005-11-08  Uros Bizjak  <uros@kss-loka.si>
 
        PR target/19340
index 3d2f36ec7679bbab0990d3e4dd37de4d464b5418..1b2d16661aba8ac8f9906bffdfec309b9e7b37ea 100644 (file)
@@ -1,3 +1,9 @@
+2005-11-08  Jason Merrill  <jason@redhat.com>
+
+       PR c++/21123
+       * method.c (use_thunk): Use build_cplus_new instead of 
+       force_target_expr.
+
 2005-11-06  Jason Merrill  <jason@redhat.com>
            James A. Morrison <phython@gcc.gnu.org>
 
index d68423ce8fe26c08bc1dd4f75f84ab64b1b78423..67e42ea1e0ea9139b76c467a17d8d0cb88508c68 100644 (file)
@@ -502,7 +502,8 @@ use_thunk (tree thunk_fndecl, bool emit_p)
                t = build3 (COND_EXPR, TREE_TYPE (t), cond, t,
                            cp_convert (TREE_TYPE (t), integer_zero_node));
            }
-         t = force_target_expr (TREE_TYPE (t), t);
+         if (IS_AGGR_TYPE (TREE_TYPE (t)))
+           t = build_cplus_new (TREE_TYPE (t), t);
          finish_return_stmt (t);
        }
 
diff --git a/gcc/testsuite/g++.dg/inherit/thunk4.C b/gcc/testsuite/g++.dg/inherit/thunk4.C
new file mode 100644 (file)
index 0000000..a6e913e
--- /dev/null
@@ -0,0 +1,23 @@
+// PR c++/21123
+
+struct A
+{
+  A( const A &a);
+  const A& operator=( const A& a);
+};
+
+struct B
+{
+  virtual A f();
+};
+
+struct C : virtual B
+{
+  virtual A f();
+  A a;
+};
+
+A C::f() 
+{
+  return a;
+}
index 4705bb12b83fdaa8d482179551eab2d764a4b377..7b1796c0800fe8bb8bfa946cf13fe799472e779e 100644 (file)
@@ -1023,7 +1023,7 @@ extern void tree_operand_check_failed (int, enum tree_code,
 
 /* In a CALL_EXPR, means that the call is the jump from a thunk to the
    thunked-to function.  */
-#define CALL_FROM_THUNK_P(NODE) ((NODE)->common.protected_flag)
+#define CALL_FROM_THUNK_P(NODE) (CALL_EXPR_CHECK (NODE)->common.protected_flag)
 
 /* In a type, nonzero means that all objects of the type are guaranteed by the
    language or front-end to be properly aligned, so we can indicate that a MEM