www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16138] New: Attributes of private functions should be inferred

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

          Issue ID: 16138
           Summary: Attributes of private functions should be inferred
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The following should work:

----------------------
private void bar() { }

 safe void foo()
{
    bar();
}
----------------------

dmd test
test.d(6): Error: safe function 'test5.foo' cannot call system function
'test.bar'

-----------------------

because attributes for private functions with bodies can be safely inferred, as
they don't have external linkage issues.

--
Jun 07 2016