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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 13 23:37:32 PST 2012


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


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> 2012-11-13 23:37:24 PST ---
D templates have an interesting feature where they can be "locally
instantiated" if their arguments refer to local arguments. This is controlled
by the "isnested" member in template.c, set by
TemplateInstance::hasNestedArgs().

It should have the effect of moving the definition of fun() into main(), like
this:

--------------------------
void main() {
   auto fun(T)(T* ret) {
      *ret = T();
   }

  struct A {
    auto f() {}
  }
  A a;
  fun!A(&a);
}
-----------------------

which compiles successfully. So I'd say it is a bug, and the fault is likely in
TemplateInstance::hasNestedArgs().

-- 
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