www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13598] New: enum isPublic(alias e) = __traits(getProtection,


          Issue ID: 13598
           Summary: enum isPublic(alias e) = __traits(getProtection, e) ==
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andre s-e-a-p.de

The output of the coding given is:
Reference: Child
source\test.d(11): Error: class app.Child member childStr is not accessible
source\app.d(8): Error: mixin app.Child.ComponentTemplate!() error

1.) Althoug childStr is not accessible the text "true" is shown
2.) By uncommenting the line, the output is as expected

module test;

enum isPublic(alias e) = __traits(getProtection, e) == "public";

template Params(this MyType)
  string[] Params()
    pragma(msg, "Reference: " ~ MyType.stringof);
    /*pragma(msg, __traits(getProtection, __traits(getMember, MyType,
    pragma(msg, isPublic!(__traits(getMember, MyType, "childStr")));            
    return [];

mixin template ComponentTemplate()
  private enum parameters = Params!(typeof(this));
  string[] getParameters()
     return parameters;

class Parent
   property string parentStr(){return "";}

module app;

import std.stdio;
import test;

class Child : Parent
  mixin ComponentTemplate;
   property string childStr(){return "";}

void main()
  auto child = new Child();

Oct 10 2014