On Sunday, 16 November 2014 at 10:41:20 UTC, deadalnix wrote:
module a;

struct A(alias foo) {
    auto foo() {
        return foo();
    }
}

module b;

import a;

void main() {
    auto a = A!bar();
}

private int bar() { return 42; }

This do not work. I think it is a bug but I see how could see it as a feature. Which one is it ?

It seems like a feature to me. Otherwise, you would have A.foo, which is in module a, calling a private function from module b. I think it is sane that the function should be public if you want to do things such as this. Furthermore, it will stop you from accidentally passing private symbols to alias template arguments when you don't mean to.

Reply via email to