www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17362] New: Don't infer return attribute for explicit scope

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

          Issue ID: 17362
           Summary: Don't infer return attribute for explicit scope
                    arguments
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: nick geany.org

auto f(scope Object i){return i;}

The above compiles with -dip1000 because parameter i is inferred as `return
scope`. As the author deliberately wrote `scope`, the compiler should error
when trying to return a scope parameter. This will help to catch bugs in
complex generic code.

--
May 01 2017