On 1/23/18 6:08 PM, Alex wrote:
On Tuesday, 23 January 2018 at 22:59:31 UTC, Steven Schveighoffer wrote:
On 1/23/18 5:52 PM, Steven Schveighoffer wrote:
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.
using -vcg-ast gives a hint:
Note that the T!(s) struct has a void *this member, that is probably
the main stack frame pointer.
So, if change the fun to static, it cannot pickup the pointer and
therefore can't call anything of the aliased object. If I get it right...
I think so. But this is a guess, as the generated call clearly never
uses that 'this' member. Interesting to me that it calls that member
'this', when 'this' is already defined!
cool option, by the way... didn't know anything about it. What does -ast
-vcg-ast means take the generated AST before optimization (I think), and
output a d-source-like file (called file.d.cg) that shows the
representation. Super useful when you are trying to figure out what the
compiler does to your code. It only happens if compilation succeeds.
-ast, I don't think does anything, but not sure if that's what your
The reason you don't know anything about it is because it's a debugging
option and not documented :) At least, that's what I was told...
If you click on the AST button on run.dlang.io, you get the same thing.