static function and access frame
Alex
sascha.orlov at gmail.com
Tue Jan 23 22:59:52 UTC 2018
On Tuesday, 23 January 2018 at 22:52:47 UTC, Steven Schveighoffer
wrote:
>
> No:
>
> void main()
> {
> auto s = S();
> auto t = T!s();
> t.fun;
> }
> struct S { void fun(){} }
> struct T(alias s){ static fun() { s.fun; } }
>
> Fails in 2.078.
>
> I don't know the reason. You would think that accessing s would
> be relative to T.fun's stack frame, and have nothing to do with
> an instance of T.
Right. This was the intention.
>
> I would file a bug, and see what the compiler devs say.
ok, thanks.
More information about the Digitalmars-d-learn
mailing list