D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1904 - wrong protection lookup for private template functions
Summary: wrong protection lookup for private template functions
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks: 5003
  Show dependency treegraph
 
Reported: 2008-03-10 23:49 UTC by Andrei Alexandrescu
Modified: 2014-02-15 13:21 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2008-03-10 23:49:21 UTC
Consider this two-file project:

// test.d
import testmod;

void main()
{
    void whatever() {}
    foo!(whatever)();
}

// testmod.d
private void bar(alias a)() {}

void foo(alias a)() {
    .bar!(a)();
}

Compiling test.d yields:

testmod.d(5): Error: function test.bar is not accessible from testmod
test.d(6): template instance test.main.foo!(whatever) error instantiating

(I thought I submitted this once, but I couldn't find it.)
Comment 1 Stewart Gordon 2008-11-20 20:10:02 UTC
The problems seems to be that the templates are being semantically analysed in the wrong scope.
Comment 2 Don 2010-04-27 11:17:10 UTC
This applies even to ancient versions of D1.
Comment 3 Kenji Hara 2011-07-14 04:23:51 UTC
D2 patch:
https://github.com/D-Programming-Language/dmd/pull/107