[Issue 11946] "need 'this' to access member" when passing field to template parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 23 22:47:58 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11946



--- Comment #19 from Kenji Hara <k.hara.pg at gmail.com> 2014-01-23 22:47:53 PST ---
(In reply to comment #18)
> OK, but when I said:
> 
> > "static" must not affect whether alias parameters receive context pointers.
> [snip]
> > "static" must only untie the function from its
> > immediate surrounding declaration context (struct, class or function frame).
> 
> I specifically meant this case. It should not matter whether the function is in
> a template or not, if it is not declared in a struct/class/function, then
> "static" should have no effect (or even be forbidden, as the compiler now
> forbids many senseless attributes).

Maybe you're misunderstanding the effect of 'static' attribute.
As far as I know, it means that:

- If 'static' attribute is specified to a nested declaration, it will make the
nested declaration 'unnested'.

In above description, of course 'nested declaration' contains the instantiated
functions that implicitly made nested, like f!x.

That's why static attribute on module level declaration is meaningless - module
level declaration is always non-nested, so 'unnesting' has no effect, and
adding static attribute to the instantiated nested function is meaningful.

> With your change, "static" is still used as
> a mechanism to tell the compiler whether the function needs the context at the
> INSTANTIATION site

As I explained above, It is expected behavior of 'static' attribute.

> which should not be necessary, as I said in comment#13
[snip]

Even if it will become possible in the future, but currently it isn't.
I have no opinion about non existing feature.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list