Bug 22336 – core.lifetime.move doesn't work with betterC on elaborate non zero structs

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-25T17:23:22Z
Last change time
2021-09-27T13:50:30Z
Keywords
betterC, pull
Assigned to
No Owner
Creator
Tomáš Chaloupka

Comments

Comment #0 by chalucha — 2021-09-25T17:23:22Z
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
Comment #1 by dlang-bot — 2021-09-26T08:16:40Z
@tchaloupka created dlang/druntime pull request #3574 "Fix issue 22336 - betterC move of non zero structs" fixing this issue: - Fix issue 22336 - betterC move of non zero structs https://github.com/dlang/druntime/pull/3574
Comment #2 by dlang-bot — 2021-09-27T13:50:30Z
dlang/druntime pull request #3574 "Fix issue 22336 - betterC move of non zero structs" was merged into master: - 6f6170f70fb24b632ad276091c3247c83e291b16 by Tomáš Chaloupka: Fix issue 22336 - betterC move of non zero structs Co-authored-by: Razvan Nitu <[email protected]> https://github.com/dlang/druntime/pull/3574