Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access violation #13

Closed
bioinfornatics opened this issue Oct 26, 2011 · 1 comment
Closed

Access violation #13

bioinfornatics opened this issue Oct 26, 2011 · 1 comment

Comments

@bioinfornatics
Copy link
Contributor

they are a problem around private var, below code:

private import std.array    : split;
private import std.stdio    : writeln;
private import std.string   : format, stripLeft, stripRight;

class Container{
    private:
        string[string] dict;
        string name;
    this( string name ){
        this.name = name;
        this.dict = dict;
    }
}
void main( string[] args ){
    string[]words = split(cast(string)"key=value", "=");
    foreach( ref string word; words )
        word.stripRight().stripLeft();

    Container c = new Container("test");
    c.dict[words[0]] = words[1];
    writeln( "strange access to private var!!!" );
    writeln( c.dict );
    writeln( c.dict["key"] );
    writeln( c.dict.keys );
}

poduce this output:

$ ldc2 test.d
$ ./test
strange access to private var!!!
["key":"value"]
value
["key"]
@AlexeyProkhin
Copy link
Member

I believe that is correct behavior. D's private restricts symbol access to the current file, not to the class the symbol declared in.

redstar pushed a commit that referenced this issue Sep 27, 2014
add DLL support for Windows Server 2003 and XP/64
timotheecour pushed a commit to timotheecour/ldc that referenced this issue Dec 13, 2017
Do not create a TypeInstance in deduceBaseClassParameters, the deduction was made more robust for Calypso needs (should have been PR'd but Calypso is always lagging far behind DMD).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants