[Issue 11946] "need 'this' to access member" when passing field to template parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 29 18:28:09 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11946
--- Comment #27 from Kenji Hara <k.hara.pg at gmail.com> 2014-01-29 18:28:07 PST ---
(In reply to comment #25)
> I suspect this should work:
>
> int f(alias A)() { return 0; }
> struct S { int x; enum y = f!x(); }
>
> whereas this should not:
>
> int f(alias A)() { return A; }
> struct S { int x; enum y = f!x(); }
>
> i.e. this check:
>
> foo3.d(1): Error: function foo3.S.f!(x).f need 'this' to access member f
>
> should not be done for arguments to template alias parameters.
Currently this is necessary.
As a technical talk, in current semantic analysis system, the "context-ness" of
a function - whether a function really needs a context or not - should be
determined without its body analysis. As far as I see, current dmd code relies
on the assumption.
To relax the limitation, we should infer the context-ness as same as attribute
inference, but it should be considered as a new language enhancement but it is
not definitely so small.
--
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