Bug 19387 – [dip1000] __fieldPostblit should be scope or deduce scope qualifier

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-11-10T08:18:52Z
Last change time
2021-03-18T12:51:38Z
Keywords
safe
Assigned to
No Owner
Creator
Илья Ярошенко

Comments

Comment #0 by ilyayaroshenko — 2018-11-10T08:18:52Z
Currently, the __fieldPostblit constructor is not scope, this cause bugs that looks like: scope variable __copytmpXXX assigned to non-scope parameter this calling AType.__fieldPostblit. For example: ------------ struct C { void* u; this(this) scope @safe {} } struct S { C c; } void foo(scope S s) @safe {} void bar(scope S s) @safe { foo(s); } ------------ <source>(9): Error: scope variable `__copytmp2` assigned to non-scope parameter `this` calling example.S.__fieldPostblit Compiler returned: 1
Comment #1 by dlang-bot — 2021-03-18T12:51:38Z
dlang/dmd pull request #12280 "Fix 19387 - Mark generated postblits as scope" was merged into master: - 5282d156fb87842f6f8870449fe00f20345847ee by MoonlightSentinel: Fix 19387 - Mark generated postblits as scope Otherwise the postblit is not callable when compiling with DIP 1000. (Assigning scope ... to non-scope `this`) https://github.com/dlang/dmd/pull/12280