www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12856] New: template alias should not perform access check

https://issues.dlang.org/show_bug.cgi?id=12856

          Issue ID: 12856
           Summary: template alias should not perform access check
           Product: D
           Version: unspecified
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

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.

--
Jun 04 2014