www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15537] New: Private function is not accessible from other


          Issue ID: 15537
           Summary: Private function is not accessible from other module
                    when compiling with -debug flag
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: freeslave93 gmail.com

Here's example:

private {
    import std.algorithm;
    import std.range;
    import std.typecons;
    alias Tuple!(int, string) Data;

private bool myCmp(Data a, Data b) {
    return a[0] < b[0];

auto bar() {
    return [Data(1, "one"), Data(2, "two")].assumeSorted!myCmp;

void main()

It's compiled without errors when building without -debug flag. But adding
-debug flag produces errors. Making myCmp public also solves the issue.

Note: I could use anonymous function, but I need the named one, since I need to
reuse it, while not making it public.

Jan 09 2016