www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17625] New: Confusing error message for private functions in


          Issue ID: 17625
           Summary: Confusing error message for private functions in
                    different modules
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ketmar ketmar.no-ip.org

i don't know how to make a clear summary for this, sorry. anyway, here is the
code. let's create three modules:

=== z00.d ===
module z00;
private int boo () { return 42; }

=== z01.d ===
module z01;
private int boo () { return 69; }

=== zmain.d ===
module zmain;
import z00, z01;
void main () { boo(); }

now, do:
dmd -c -o- zmain.d z00.d z01.d

and you'll get:
zmain.d(3): Error: z01.boo at z01.d(2) conflicts with z00.boo at z00.d(2)
zmain.d(3): Error: function z01.boo is not accessible from module zmain

while the second error message gives at least *some* information, the first one
is not only completely useless, but is misleading too: user may think that he
has to rename one of the private functions to get rid of it.

i think that compiler should just say "undefined identifier `boo`", 'cause
visibility rules mandates that private functions are not visible at that point,
and there is no sense in trying to resolve anything there.

Jul 08