diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-20 07:28:35 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-20 07:28:35 +0000 |
commit | 38d0fc0c4bac0de01c53247dea315cc56a433a3e (patch) | |
tree | 5a8d0059488f9430e6d776fb79b0d30d44c2ef11 | |
parent | b6ec720b36a0d14fbf273328b88ee26106c03db5 (diff) | |
download | ppe42-gcc-38d0fc0c4bac0de01c53247dea315cc56a433a3e.tar.gz ppe42-gcc-38d0fc0c4bac0de01c53247dea315cc56a433a3e.zip |
* call.c (build_new_method_call): Ensure that explicit calls of
destructors have type "void".
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122153 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0c6b90d7edd..c3263933a46 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2007-02-19 Mark Mitchell <mark@codesourcery.com> + + * call.c (build_new_method_call): Ensure that explicit calls of + destructors have type "void". + 2007-02-19 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * typeck.c (build_binary_op): Replace -Wstring-literal-comparison diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b1b5a8e8277..f60c59260fd 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5528,6 +5528,20 @@ build_new_method_call (tree instance, tree fns, tree args, && TREE_SIDE_EFFECTS (instance_ptr)) call = build2 (COMPOUND_EXPR, TREE_TYPE (call), instance_ptr, call); + else if (call != error_mark_node + && DECL_DESTRUCTOR_P (cand->fn) + && !VOID_TYPE_P (TREE_TYPE (call))) + /* An explicit call of the form "x->~X()" has type + "void". However, on platforms where destructors + return "this" (i.e., those where + targetm.cxx.cdtor_returns_this is true), such calls + will appear to have a return value of pointer type + to the low-level call machinery. We do not want to + change the low-level machinery, since we want to be + able to optimize "delete f()" on such platforms as + "operator delete(~X(f()))" (rather than generating + "t = f(), ~X(t), operator delete (t)"). */ + call = build_nop (void_type_node, call); } } } |