Bug 22499 – Copy construction of nested struct rejected
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-11-09T22:17:03Z
Last change time
2021-11-30T10:05:33Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
timon.gehr
Comments
Comment #0 by timon.gehr — 2021-11-09T22:17:03Z
DMD 2.098.0:
---
auto makeFoo(){
struct Foo{
this(ref typeof(this)){}
}
return Foo();
}
void main(){
auto foo=makeFoo();
auto bar=foo; // error
}
---
Yields:
---
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.
Comment #1 by razvan.nitu1305 — 2021-11-30T10:05:33Z
*** This issue has been marked as a duplicate of issue 22239 ***