www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19387] New: [dip1000] __fieldPostblit should be scope or

https://issues.dlang.org/show_bug.cgi?id=19387

          Issue ID: 19387
           Summary: [dip1000] __fieldPostblit should be scope or deduce
                    scope qualifier
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ilyayaroshenko gmail.com

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

--
Nov 10 2018