www.fgks.org   »   [go: up one dir, main page]

Issue 19387 - [dip1000] __fieldPostblit should be scope or deduce scope qualifier
Summary: [dip1000] __fieldPostblit should be scope or deduce scope qualifier
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: safe
Depends on:
Blocks:
 
Reported: 2018-11-10 08:18 UTC by Илья Ярошенко
Modified: 2021-03-18 12:51 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Илья Ярошенко 2018-11-10 08:18:52 UTC
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 Dlang Bot 2021-03-18 12:51:38 UTC
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