UDA: getAttributes does not play well with topleof

Walter Bright newshound2 at digitalmars.com
Mon Dec 17 13:26:02 PST 2012


On 12/17/2012 8:40 AM, d coder wrote:
> But Walter, even the code below does not work.
> Error: first argument is not a symbol
> tuple(false)

That's right, msg is undefined!!


> 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);
             ^^^
> }



More information about the Digitalmars-d mailing list