[Issue 22239] New: Can't migrate from postblits if they are used without frame pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 25 13:08:25 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22239

          Issue ID: 22239
           Summary: Can't migrate from postblits if they are used without
                    frame pointer
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: Ajieskola at gmail.com

So, postblits are considered a legacy construct that should be migrated to copy
constructors. However, there is an instance where that cannot be done:

---
struct PostBlitted(alias al){
  this(this){}
  void x(){} //a member function so that an instance contains a frame pointer
}

struct CopyConstructed(alias al){
  this(ref typeof(this)){};
  void x(){} //a member function so that an instance contains a frame pointer
}

void main(){
  PostBlitted!(x => x) a;
  CopyConstructed!(x => x) b;

  a.f; //compiles
  b.f; //does not
}

void f(T)(T x){
  T y = x;
}
---

There should be a way to define a copy constructor so that it works even when
the caller does not have a frame pointer for the new struct instance.

--


More information about the Digitalmars-d-bugs mailing list