From c883d082d79ec7ed590dc3758ce95ad50c2ca27f Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Wed, 7 Feb 2024 23:52:57 -0800 Subject: [PATCH] another correction for caller destroying args --- compiler/src/dmd/inline.d | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/compiler/src/dmd/inline.d b/compiler/src/dmd/inline.d index 62f17e7c5179..9f198984d28b 100644 --- a/compiler/src/dmd/inline.d +++ b/compiler/src/dmd/inline.d @@ -1813,16 +1813,21 @@ private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool stat * 2. don't inline when the return value has a destructor, as it doesn't * get handled properly */ - if (tf.next && tf.next.ty != Tvoid && - (!(fd.hasReturnExp & 1) || - statementsToo && hasDtor(tf.next)) && - !hdrscan) + if (auto tfnext = tf.next) { - static if (CANINLINE_LOG) + /* for the isTypeSArray() case see https://github.com/dlang/dmd/pull/16145#issuecomment-1932776873 + */ + if (tfnext.ty != Tvoid && + (!(fd.hasReturnExp & 1) || + hasDtor(tfnext) && (statementsToo || tfnext.isTypeSArray())) && + !hdrscan) { - printf("\t3: no %s\n", fd.toChars()); + static if (CANINLINE_LOG) + { + printf("\t3: no %s\n", fd.toChars()); + } + goto Lno; } - goto Lno; } /* https://issues.dlang.org/show_bug.cgi?id=14560