www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23592] New: [REG2.095] deprecation on calling aliased private

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

          Issue ID: 23592
           Summary: [REG2.095] deprecation on calling aliased private
                    imported function without parens
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

Testcase consists of two files, a.d and b.d.
Compilation `dmd -de a.d -c -o-` gives the message since 2.095:
```
a.d(4): Deprecation: Function b.C.template_function!int.template_function of
type pure nothrow  nogc  safe void() is not accessible from module a
```
The deprecation message is gone when calling _with_ parens: `c.foo()`.


Testcase, file a.d:
```
import b;

void foo(C c) {
    c.foo;
    // c.foo();  // with parens it works without deprecation :-)
}
```

Testcase, file b.d:
```
class C {
    private void template_function(T)() {}

    alias foo = template_function!int;
}
```

--
Dec 30 2022