<div>Greetings</div><div><br></div><div>I am trying out the new UDA functionality in the github dmd. I wanted to find out what different fields of a class carry a particular attribute. So I tried to look at the set of attributes on all the fields returned by tupleof. Interestingly I got nothing. On the other hand, when I explicitly specify a particular field in the object, the attribute is getting printed nicely on my screen.</div>

<div><br></div><div>So my question is: Is this a bug in DMD, or am I doing something plainly wrong?</div><div><br></div><div>If this is not a bug, I want to find out if there would be a way to find what different fields of a class carry a given attribute?</div>

<div><br></div><div>Thanks and Regards</div><div>- Puneet</div><div><br></div><div><br></div><div>template Tuple(T...) {</div><div>  alias T Tuple;</div><div>}</div><div><br></div><div>enum Bar;</div><div>class Foo {</div>

<div>  @Bar int a;</div><div>  int b;</div><div>}</div><div><br></div><div>void main() {</div><div>  Foo foo = new Foo;</div><div>  foreach(ref l; foo.tupleof) {</div><div>    alias Tuple!(__traits(getAttributes, l)) tp;</div>

<div>    pragma(msg, tp);<span class="Apple-tab-span" style="white-space:pre">          </span>// prints nothing</div><div>  }</div><div>  alias Tuple!(__traits(getAttributes, foo.a)) tp;</div><div>  pragma(msg, tp);             // prints (Bar)</div>

<div>}</div><div><br></div>