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

Cannot access private template argument #19522

Open
dlangBugzillaToGithub opened this issue Jan 1, 2019 · 0 comments
Open

Cannot access private template argument #19522

dlangBugzillaToGithub opened this issue Jan 1, 2019 · 0 comments
Labels

Comments

@dlangBugzillaToGithub
Copy link

Victor Porton (@vporton) reported this on 2019-01-01T14:18:04Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=19536

Description

Originally appeared in https://stackoverflow.com/q/53982974/856090

//handled_record.d:

module handled_record;

template CObjects(alias destructor) {
    void f() {
        destructor();
    }
}

//world.d:

module world;

import handled_record;

private void free() { }

alias objects = CObjects!(free);

Compiling:

$ dmd -c *.d
handled_record.d(5): Error: function world.free is not accessible from module handled_record
world.d(7): Error: template instance `handled_record.CObjects!(free)` error instantiating

The error disappears if I remove private keyword.

Is it a compiler bug? (In my understanding the alias symbol passed to a template should be accessible by the template because it is explicitly passed to the template, even if it is private.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant