[Issue 20940] New: DMD silently ignores struct copy constructor if one of the element struct has postblit
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 17 03:21:12 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20940
Issue ID: 20940
Summary: DMD silently ignores struct copy constructor if one of
the element struct has postblit
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: puneet at coverify.org
Copy constructor for Bar and Frop are silently ignored. When codebase is large
with Bar having a significant number of elements, it becomes very confusing why
copy constructor of Bar and Frop are getting ignored. Perhaps Foo could as well
be imported from a library module.
////
import std.stdio;
struct Frop {
this (ref inout(Frop) frop) {
writeln("Frop copy constructor");
}
}
struct Foo {
this(this) {
writeln("Foo postblit constructor");
}
}
struct Bar {
Foo foo;
Frop frop;
this (ref inout(Bar) bar) {
writeln("Bar copy constructor");
foo = bar.foo;
frop = bar.frop;
}
}
void main() {
Bar bar;
Bar bar2 = bar;
}
--
More information about the Digitalmars-d-bugs
mailing list