Skip to content

Commit

Permalink
do not lower if using CTFE (#14940)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Mar 3, 2023
1 parent f9c78b7 commit abb7836
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler/src/dmd/expressionsem.d
Expand Up @@ -3797,8 +3797,12 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
result = id.expressionSemantic(sc);
return;
}
else if (!exp.onstack && !exp.type.isscope())
else if (!(sc.flags & (SCOPE.ctfe | SCOPE.ctfeBlock | SCOPE.compile)) && // interpreter can handle these
!exp.onstack && !exp.type.isscope()) // these won't use the GC
{
/* replace `new T(arguments)` with `core.lifetime._d_newclassT!T(arguments)`
* or `_d_newclassTTrace`
*/
auto hook = global.params.tracegc ? Id._d_newclassTTrace : Id._d_newclassT;
if (!verifyHookExist(exp.loc, *sc, hook, "new class"))
return setError();
Expand Down

0 comments on commit abb7836

Please sign in to comment.