On Sunday, 9 May 2021 at 17:37:40 UTC, Andrey Zherikov wrote:
Is this a bug?
My best guess is that, since the struct doesn't have any member functions the compiler has decided that the struct doesn't need any access to the main function's context/frame pointer, so the struct has implicitly become a `static struct`.
Marking the struct `static` yourself while keeping the member function, will show that it can then compile.
You can also move your `foo` function into the main function and it'll compile. Oddly the output ends up becoming: `T(1, null)` which I didn't really expect.
Just a guess though.