[Issue 20675] New: dip1000 improper error about copying scope parameter into allocated memory
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Mar 16 08:25:30 UTC 2020
    
    
  
https://issues.dlang.org/show_bug.cgi?id=20675
          Issue ID: 20675
           Summary: dip1000 improper error about copying scope parameter
                    into allocated memory
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com
Compile with -preview=dip1000:
---
struct D {
    int pos;
    char* p;
}
void test(scope ref D d) @safe {
    D[] da;
// works
    const pos = d.pos;
    da ~= D(pos, null);
// wrongly fails with
// Error: scope variable d may not be copied into allocate memory
    da ~= D(d.pos, null);
}
---
--
    
    
More information about the Digitalmars-d-bugs
mailing list