www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9809] New: Need a better diagnostic on accessing 'alias this' to private symbols

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9809

           Summary: Need a better diagnostic on accessing 'alias this' to
                    private symbols
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



19:39:08 PDT ---
module foo;

struct S
{
    void func() { }
}

struct X
{
    public alias s this;
    private S s;
}

module test;

import foo;

void main()
{
    X x;
    x.func();
}

$ rdmd test.d
 test.d(8): Error: undefined identifier 'func'
I'm not exactly sure, perhaps the public alias to a private symbol should be disallowed in the first place. Otherwise a better diagnostic should be made. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 24 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9809




19:42:13 PDT ---

 struct X
 {
     public alias s this;
     private S s;
 }
Btw, the reason I needed this is because I want 's' fields/methods to be accessible, but I do not want the user to be able to assign 's' to something else. Perhaps I should have used: struct NoAssign { disable void opAssign(T...)(T t) { } S s; alias s this; } struct X { alias s this; NoAssign s; } Not too sure.. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 24 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9809


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME



16:12:24 PDT ---
The diagnostic in 2.063.2 is now:

 Error: struct foo.X member s is not accessible
-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2013