summaryrefslogtreecommitdiff
path: root/gcc/d/dmd/clone.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d/dmd/clone.d')
-rw-r--r--gcc/d/dmd/clone.d6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/d/dmd/clone.d b/gcc/d/dmd/clone.d
index 2ed0dc7bdd1..9c8c1c316bf 100644
--- a/gcc/d/dmd/clone.d
+++ b/gcc/d/dmd/clone.d
@@ -912,8 +912,8 @@ void buildDtors(AggregateDeclaration ad, Scope* sc)
ex = new DotVarExp(loc, ex, v);
// This is a hack so we can call destructors on const/immutable objects.
- // Do it as a type 'paint'.
- ex = new CastExp(loc, ex, v.type.mutableOf());
+ // Do it as a type 'paint', `cast()`
+ ex = new CastExp(loc, ex, MODFlags.none);
if (stc & STC.safe)
stc = (stc & ~STC.safe) | STC.trusted;
@@ -1588,7 +1588,7 @@ private bool needCopyCtor(StructDeclaration sd, out bool hasCpCtor)
auto tf = ctorDecl.type.toTypeFunction();
const dim = tf.parameterList.length;
- if (dim == 1)
+ if (dim == 1 || (dim > 1 && tf.parameterList[1].defaultArg))
{
auto param = tf.parameterList[0];
if (param.type.mutableOf().unSharedOf() == sd.type.mutableOf().unSharedOf())