[Issue 12856] New: template alias should not perform access check

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 4 17:46:15 PDT 2014


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 at puremagic.com
          Reporter: code at 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.

--


More information about the Digitalmars-d-bugs mailing list