www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20531] New: Error message for invalid private data access

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

          Issue ID: 20531
           Summary: Error message for invalid private data access very
                    confusing
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

--- mod1.d
module mod1;

struct S
{
    private int x;
}
--- mod2.d
module mod2;
import mod1;

void main()
{
    S s;
    int x = s.x;
}
---

Error: no property `x` for type `S`, did you mean `mod1.S.x`?

I would expect it to complain that either x doesn't exist or is not accessible.
It's not helpful to say I should try doing what I actually did...

--
Jan 23 2020