[Issue 3051] Passing alias to member function does not work (1/2)
https://issues.dlang.org/show_bug.cgi?id=3051 Dennis changed: What|Removed |Added Status|NEW |RESOLVED CC||dkor...@live.nl Resolution|--- |DUPLICATE --- Comment #8 from Dennis --- It is a bit weird to mark this as a duplicate of an issue filed later, but since 5710 has been marked as fixed this works too now. *** This issue has been marked as a duplicate of issue 5710 *** --
[Issue 3051] Passing alias to member function does not work (1/2)
https://issues.dlang.org/show_bug.cgi?id=3051 Maksim Zholudev changed: What|Removed |Added CC||maxim...@gmail.com --
[Issue 3051] Passing alias to member function does not work (1/2)
http://d.puremagic.com/issues/show_bug.cgi?id=3051 Dicebot changed: What|Removed |Added CC||pub...@dicebot.lv --- Comment #7 from Dicebot 2013-08-02 06:09:54 PDT --- So old and so annoying ;) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3051] Passing alias to member function does not work (1/2)
http://d.puremagic.com/issues/show_bug.cgi?id=3051 --- Comment #6 from Sobirari Muhomori 2009-06-10 03:30:25 PDT --- void foo(delegate void() dg) { dg(); } class C { int y; void fun() { int x = 0; auto me=this; void gun() { stack.x++; stack.me.y++; } foo(&gun); //closure } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3051] Passing alias to member function does not work (1/2)
http://d.puremagic.com/issues/show_bug.cgi?id=3051 --- Comment #5 from Steven Schveighoffer 2009-06-05 08:10:38 PDT --- (In reply to comment #4) > In fact, I'm now unsure why that can't work for both these bugs too... One other thing about having two "this" pointers, how come this can work (tested with dmd 1.043)? void foo(delegate void() dg) { dg(); } class C { int y; void fun() { int x = 0; void gun() { x++; y++; } // 2 this pointers needed here! foo(&gun); } } So probably there should be no conflict. And the "this" pointer of the alias'd function in the bug's example should be statically calculatable, so it doesn't need to occupy a register. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3051] Passing alias to member function does not work (1/2)
http://d.puremagic.com/issues/show_bug.cgi?id=3051 --- Comment #4 from Steven Schveighoffer 2009-06-05 08:00:23 PDT --- Since the template is instantiated differently for each function that it is called with, it's entirely possible to "know" the stack frame pointer since it will be a constant offset from the current stack pointer. I think that is why it can work. In fact, I'm now unsure why that can't work in the other bug too... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3051] Passing alias to member function does not work (1/2)
http://d.puremagic.com/issues/show_bug.cgi?id=3051 --- Comment #3 from Sobirari Muhomori 2009-06-05 07:36:54 PDT --- huh... &fun is a delegate! Does it take stack pointer with all needed information? Quite hackish, I would say... foreign function messing my stack... ugh... So it behaves as nested function, but they are said to access this pointer through stack, not register. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3051] Passing alias to member function does not work (1/2)
http://d.puremagic.com/issues/show_bug.cgi?id=3051 Steven Schveighoffer changed: What|Removed |Added CC||schvei...@yahoo.com --- Comment #2 from Steven Schveighoffer 2009-06-05 06:17:44 PDT --- I thought the same as you at first, but I tried this code, and it works: void fun(alias fx)() { fx(); } void main() { int x = 0; void hun() { x++; } fun!(hun)(); writefln("%s", x); // outputs 1 } So I think Andrei is right, it is probably a conflict of 2 this pointers required. The second bug is legit, as it is equivalent to what I wrote here, but I think this one is invalid (need 2 this pointers). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3051] Passing alias to member function does not work (1/2)
http://d.puremagic.com/issues/show_bug.cgi?id=3051 --- Comment #1 from Sobirari Muhomori 2009-06-05 05:20:57 PDT --- how on earth templates can be parameterized with values unevaluatable at compile time? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---