aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2007-08-15 00:02:44 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2007-08-15 00:02:44 +0000
commit67f9922bb02e5b16b335e88d3dd12dba559c167f (patch)
tree552407641fef7fc959d86f925e1a608c3b80574f
parente7303e85aea62c60818fe9586afab8f397e8a4d9 (diff)
downloadgcc-67f9922bb02e5b16b335e88d3dd12dba559c167f.zip
gcc-67f9922bb02e5b16b335e88d3dd12dba559c167f.tar.gz
gcc-67f9922bb02e5b16b335e88d3dd12dba559c167f.tar.bz2
semantics.c (finish_omp_clauses): Strip a NOP_EXPR if constructors and destructors return this.
* semantics.c (finish_omp_clauses): Strip a NOP_EXPR if constructors and destructors return this. From-SVN: r127499
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/semantics.c22
2 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b9fe07f..e632aac 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-14 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (finish_omp_clauses): Strip a NOP_EXPR if
+ constructors and destructors return this.
+
2007-08-14 Paolo Carlini <pcarlini@suse.de>
PR c++/27211
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 2a4fa37..9d0f9df 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3665,6 +3665,17 @@ finish_omp_clauses (tree clauses)
t = build_special_member_call (NULL_TREE,
complete_ctor_identifier,
t, inner_type, LOOKUP_NORMAL);
+
+ if (targetm.cxx.cdtor_returns_this ())
+ /* Because constructors and destructors return this,
+ the call will have been cast to "void". Remove the
+ cast here. We would like to use STRIP_NOPS, but it
+ wouldn't work here because TYPE_MODE (t) and
+ TYPE_MODE (TREE_OPERAND (t, 0)) are different.
+ They are VOIDmode and Pmode, respectively. */
+ if (TREE_CODE (t) == NOP_EXPR)
+ t = TREE_OPERAND (t, 0);
+
t = get_callee_fndecl (t);
TREE_VEC_ELT (info, 0) = t;
}
@@ -3676,6 +3687,17 @@ finish_omp_clauses (tree clauses)
t = build1 (INDIRECT_REF, inner_type, t);
t = build_special_member_call (t, complete_dtor_identifier,
NULL, inner_type, LOOKUP_NORMAL);
+
+ if (targetm.cxx.cdtor_returns_this ())
+ /* Because constructors and destructors return this,
+ the call will have been cast to "void". Remove the
+ cast here. We would like to use STRIP_NOPS, but it
+ wouldn't work here because TYPE_MODE (t) and
+ TYPE_MODE (TREE_OPERAND (t, 0)) are different.
+ They are VOIDmode and Pmode, respectively. */
+ if (TREE_CODE (t) == NOP_EXPR)
+ t = TREE_OPERAND (t, 0);
+
t = get_callee_fndecl (t);
TREE_VEC_ELT (info, 1) = t;
}