On Sunday, 9 May 2021 at 17:53:07 UTC, SealabJaster wrote:
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
On Sunday, 9 May 2021 at 17:37:40 UTC, Andrey Zherikov wrote:
...
https://run.dlang.io/is/sCUdXe shows this a bit more clearly.
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
On Sunday, 9 May 2021 at 17:37:40 UTC, Andrey Zherikov wrote:
Compilation of this code:
```d
auto foo(T)()
{
return T(); // Error: cannot access frame pointer of
`onlineapp.main.T`
}
void main()
{
struct T
{
int a=1;
void argsFunc(int a) {} // (1)
}
Compilation of this code:
```d
auto foo(T)()
{
return T(); // Error: cannot access frame pointer of
`onlineapp.main.T`
}
void main()
{
struct T
{
int a=1;
void argsFunc(int a) {} // (1)
}
pragma(msg,foo!T());
}
```
fails with this error:
```