Error "Outer Function Context is Needed" when class declared in unittest
Adam D Ruppe
destructionator at gmail.com
Thu Jan 5 13:47:24 UTC 2023
On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote:
> Why is this error only found when declaring a class in the
> unittest?
A unittest is just a special function, it can run code and have
local variables.
classes and structs declared inside it have access to those local
contexts, which it calls the outer function context.
Make the outer class `static` too to lift it out of this and your
error should go away.
More information about the Digitalmars-d-learn
mailing list