[Issue 8863] struct passed to template: cannot access frame pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 7 05:12:12 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8863



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-11-07 05:12:10 PST ---
This is a corner case of fixing bug 8339, but I think the current behavior is
intended.

Let's try to replace the out parameter usage to a simple pointer in your code.

auto fun(T)(T* ret) {
  *ret = T();  // Initialize the referred variable to T.init.
               // It's automatically inserted by the compiler.
}
void main() {
  struct A {
    auto f() {}
  }
  A a;
  fun!A(&a);
}

With current dmd the 'out' variable is initialized at the callee side, not
caller side. It requires A's enclosing frame pointer for the correct
initialization, but fun!A cannot access to main's frame, so compiler reports
errors as you have shown.

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


More information about the Digitalmars-d-bugs mailing list