www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22499] New: Copy construction of nested struct rejected


          Issue ID: 22499
           Summary: Copy construction of nested struct rejected
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timon.gehr gmx.ch

DMD 2.098.0:

auto makeFoo(){
    struct Foo{
        this(ref typeof(this)){}
    return Foo();

void main(){
    auto foo=makeFoo();
    auto bar=foo; // error


Error: cannot access frame pointer of `tt.makeFoo.Foo`

This makes no sense, as there is a frame pointer in foo that can just be copied
over to bar before calling the copy constructor. core.lifetime.copyEmplace
actually handles this case correctly.

Nov 09 2021