D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12856 - template alias should not perform access check
Summary: template alias should not perform access check
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
: 13744 (view as issue list)
Depends on:
Blocks:
 
Reported: 2014-06-05 00:46 UTC by Martin Nowak
Modified: 2020-02-02 00:01 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2014-06-05 00:46:15 UTC
cat > bug.d << CODE
import bug2;

private void foo() {}
void main() { bar!foo(); }
CODE

cat > bug2.d << CODE
void bar(alias foo)() { foo(); }
CODE

----
dmd -c bug.d
----
bug2.d(1): Error: function bug.foo is not accessible from module bug2
bug.d(4): Error: template instance bug2.bar!(foo) error instantiating
----

The access check should be performed on the template instance argument, but not when using the aliased symbol in the template declaration module.
So template alias parameters should behave like public aliases to private symbols.
Comment 1 Martin Nowak 2015-04-30 21:18:49 UTC
*** Issue 13744 has been marked as a duplicate of this issue. ***
Comment 2 moonlightsentinel 2020-02-02 00:01:06 UTC
Works on DMD 2.090