http://d.puremagic.com/issues/show_bug.cgi?id=9100
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #6 from [email protected] 2012-12-09 13:20:55 PST --- (In reply to comment #2) > As a related note, this program runs successfully with no error in current > compiler. > It looks weird, but is expected from the view of language consistency. > > void main(){ (new C(1)).test(); } > template Id(alias A) { alias Id = A; } > class C > { > int n; > this(int x){ n = x; } > int fun(){ return n; } > > void test() > { > auto c = new C(2); > assert(c.fun() == 2); > alias f = Id!(c.fun); > assert(f() == 1); // calls this.fun, not c.fun > } > } Language _sanity_ is what is important. It should call c.fun or be a compile time error. Deliberately assigning unsupported code strange semantics in order to be consistent with existing buggy compiler behaviour just makes it harder to lift restrictions later. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
