[Issue 15537] New: Private function is not accessible from other module when compiling with -debug flag
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sat Jan  9 15:31:16 PST 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=15537
          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 at puremagic.com
          Reporter: freeslave93 at 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()
{
    bar();
}
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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list