www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - getSymbolsByUDA does not take private symbols under consideration.

reply Piotr Mitana <the.mail.of.mi2 gmail.com> writes:
Hello,

The code below:

================
import std.traits;

enum Attr;

class MyClass
{
     private  Attr int a;
     static assert(getSymbolsByUDA!(typeof(this), MyClass).length 
== 1);
}
================

does not compile as static assertion fails. Making the filed a 
public makes it compile properly. Should I file a bug or is by 
design?
Feb 16 2018
next sibling parent Anonymouse <asdf asdf.net> writes:
On Friday, 16 February 2018 at 09:26:47 UTC, Piotr Mitana wrote:
 Hello,

 The code below:

 ================
 import std.traits;

 enum Attr;

 class MyClass
 {
     private  Attr int a;
     static assert(getSymbolsByUDA!(typeof(this), 
 MyClass).length == 1);
 }
 ================

 does not compile as static assertion fails. Making the filed a 
 public makes it compile properly. Should I file a bug or is by 
 design?
getSymbolsByUDA seems to have some visibility thing going on. Related to https://issues.dlang.org/show_bug.cgi?id=17973 perhaps? Though that only gives deprecation warnings, not errors.
Feb 16 2018
prev sibling parent bauss <jj_1337 live.dk> writes:
On Friday, 16 February 2018 at 09:26:47 UTC, Piotr Mitana wrote:
 Hello,

 The code below:

 ================
 import std.traits;

 enum Attr;

 class MyClass
 {
     private  Attr int a;
     static assert(getSymbolsByUDA!(typeof(this), 
 MyClass).length == 1);
 }
 ================

 does not compile as static assertion fails. Making the filed a 
 public makes it compile properly. Should I file a bug or is by 
 design?
It's definitely a bug!
Feb 16 2018