User Defined Attributes

Tove tove at fransson.se
Tue Nov 6 07:14:41 PST 2012


On Tuesday, 6 November 2012 at 13:14:50 UTC, Adam D. Ruppe wrote:
> On Tuesday, 6 November 2012 at 07:55:51 UTC, Walter Bright 
> wrote:
>> User Defined Attributes (UDA) are compile time expressions 
>> that can be attached to a declaration.
>
> Hmmm, it didn't work on the most important place for my use 
> case, function parameters:
>
> void a(["test"] int foo) {
>     pragma(msg, __traits(getAttributes, foo));
> }
>

Hmmm, actually it doesn't work in plain function/block scope 
either.

void a()
{
   ["test"] int foo;
   pragma(msg, __traits(getAttributes, foo));
}
Error: found 'int' when expecting ';' following statement



More information about the Digitalmars-d-announce mailing list