www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19673] New: __traits(getProtection) Cannot read the

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

          Issue ID: 19673
           Summary: __traits(getProtection) Cannot read the protection
                    level of interface members
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: flyboynw gmail.com

Consider the following code:

module mod1;
public Interface I {
    public int method();
}

-----
module mod2;
import mod1;

void main() {
    auto protection = __traits(getProtection, I.method); //Compiler error
}

This could be a bug in a number of a different ways.
1: __traits(getProtection) should be able to read interface member protection
levels.
2: Interfaces are incorrectly allowed by the compiler.
3: The specification should annotate that protection levels are allowed on
interface members.

--
Feb 12 2019