On Mon, Dec 17, 2012 at 9:56 PM, Walter Bright
<newshound2@digitalmars.com> wrote:
On 12/17/2012 3:55 AM, d coder wrote:
So my question is: Is this a bug in DMD, or am I doing something plainly wrong?
You're doing something wrong. Consider:
@Bar int i = 3;
int x = i;
The UDA does not get transferred to x. This is why your loop:
foreach(ref l; foo.tupleof)
does not transfer the UDAs to l.
But Walter, even the code below does not work.
Error: first argument is not a symbol
template Tuple(T...) {
alias T Tuple;
}
enum Bar;
class Foo {
@Bar int a;
}
void main()
{
Foo foo = new Foo;
alias Tuple!(__traits(getAttributes, foo.tupleof[0])) tp;
pragma(msg, tp);
}