Bug 13744 – Cannot pass private symbol as alias parameter
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2014-11-17T22:18:00Z
Last change time
2015-04-30T21:18:49Z
Assigned to
nobody
Creator
deadalnix
Comments
Comment #0 by deadalnix — 2014-11-17T22:18:59Z
module a;
struct A(alias foo) {
auto bar() {
return foo();
}
}
module b;
import a;
void main() {
auto a = A!bar();
}
private int bar() { return 42; }
This is failing because a.A.foo is trying to access b.bar which is private.
Comment #1 by code — 2014-11-17T22:47:50Z
This has bit me several times too. I regard it as a bug because it forces you to make a symbol public that should never be used from other modules.
Comment #2 by public — 2014-12-01T11:45:15Z
This can be both valid bug report and WON'T FIX depending on final decision regarding symbol visibility (DIP 22 & friends). Currently such symbol relation is not well-defined in spec and works differently in different contexts.
Comment #3 by code — 2015-04-30T21:18:49Z
*** This issue has been marked as a duplicate of issue 12856 ***