aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/expr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d/expr.cc')
-rw-r--r--gcc/d/expr.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc
index 3168056..2831eef 100644
--- a/gcc/d/expr.cc
+++ b/gcc/d/expr.cc
@@ -1757,7 +1757,7 @@ public:
/* C++ constructors return void, even though front-end semantic
treats them as implicitly returning `this'. Set returnvalue
to override the result of this expression. */
- if (fd->isCtorDeclaration () && fd->linkage == LINK::cpp)
+ if (fd->isCtorDeclaration ())
{
thisexp = d_save_expr (thisexp);
returnvalue = thisexp;
@@ -1846,6 +1846,11 @@ public:
{
tree init = TARGET_EXPR_INITIAL (cleanup);
TARGET_EXPR_INITIAL (cleanup) = compound_expr (init, exp);
+
+ /* Keep the return value outside the TARGET_EXPR. */
+ if (returnvalue != NULL_TREE)
+ cleanup = compound_expr (cleanup, TREE_OPERAND (exp, 1));
+
exp = cleanup;
}
@@ -1856,7 +1861,7 @@ public:
void visit (DelegateExp *e)
{
- if (e->func->semanticRun == PASSsemantic3done)
+ if (e->func->semanticRun == PASS::semantic3done)
{
/* Add the function as nested function if it belongs to this module.
ie: it is a member of this module, or it is a template instance. */