diff --git a/IDEHelper/Compiler/CeMachine.cpp b/IDEHelper/Compiler/CeMachine.cpp index 97bcdf12..26426ba2 100644 --- a/IDEHelper/Compiler/CeMachine.cpp +++ b/IDEHelper/Compiler/CeMachine.cpp @@ -4911,7 +4911,11 @@ BfTypedValue CeContext::Call(CeCallSource callSource, BfModule* module, BfMethod if (!isConst) { - if ((argIdx != thisArgIdx) && (argIdx != appendAllocIdx)) + if ((argIdx == thisArgIdx) && (methodInstance->mMethodDef->mMethodType == BfMethodType_Ctor)) + { + // Allow non-const 'this' for ctor + } + else if (argIdx != appendAllocIdx) { Fail(StrFormat("Non-constant argument for param '%s'", methodInstance->GetParamName(paramIdx).c_str())); return BfTypedValue(); diff --git a/IDEHelper/Tests/src/Comptime.bf b/IDEHelper/Tests/src/Comptime.bf index 2b2b418c..80c32d30 100644 --- a/IDEHelper/Tests/src/Comptime.bf +++ b/IDEHelper/Tests/src/Comptime.bf @@ -220,7 +220,7 @@ namespace Tests String serializeBuffer = new .(); - Compiler.Assert(!type.IsUnion); + Runtime.Assert(!type.IsUnion); for (let field in type.GetFields()) {