www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18000] New: [scope] auto-generated opAssign not scope aware

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

          Issue ID: 18000
           Summary: [scope] auto-generated opAssign not scope aware
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
module bug;

struct File
{
 safe  nogc:
    ~this() scope
    {
    }

    void* f;
}

void test()  safe  nogc
{
    scope File f;
    f = File();
}
CODE
dmd -c -dip1000 bug
----
bug.d(16): Error: scope variable f assigned to non-scope parameter this calling
bug.File.opAssign
----

We should infer scope for any auto-generated functions like opAssign.

--
Nov 21