reflaxe.CPP
reflaxe.CPP copied to clipboard
Do not allocate with `new` expression for Ptr
This should cause error. Allocation should require explicit API function call.
class SomeClass {
public function new() {}
}
function main() {
final a: cxx.Ptr<SomeClass> = new SomeClass();
}
That's correct! Although new call in C++ sometime act like anti-pattern. But this issue should be an article in FAQs or wiki best practices.
I'll document it. Even give details in the error message 👌
I don't know why I didn't do this from the start, unexpected new allocs are such a hassle. 💀
👍