[Issue 22336] New: core.lifetime.move doesn't work with betterC on elaborate non zero structs
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 25 17:23:22 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22336
Issue ID: 22336
Summary: core.lifetime.move doesn't work with betterC on
elaborate non zero structs
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: chalucha at gmail.com
Test case fails with betterC:
```D
import core.lifetime;
import core.stdc.stdio;
struct Foo {
int f = -1; // works if left to init value
@disable this(this);
}
extern(C) void main() {
Foo a = Foo(42);
Foo b = move(a);
assert(a.f == -1);
assert(b.f == 42);
printf("ok\n");
}
```
Ends up with:
```
/home/tomas/dlang/dmd-2.097.2/linux/bin64/../../src/druntime/import/core/lifetime.d(2126,29):
Error: `TypeInfo` cannot be used with -betterC
```
That leads here:
https://github.com/dlang/druntime/blob/f978df34a48613492240e8398227419b14002bef/src/core/lifetime.d#L2126
--
More information about the Digitalmars-d-bugs
mailing list