Possible UDA bug

Maxim Fomin maxim at maxim-fomin.ru
Sun Feb 24 09:45:37 PST 2013


On Sunday, 24 February 2013 at 16:36:05 UTC, jerro wrote:
>> The reason the second
>> does not compile is because the statement is evaluated at CT, 
>> and
>> interpreter cannot evaluate call without source, like a regular
>> explicit call.
>
> I know that, the thing is that it will give this error every 
> time you try to use the attributes of foo (or am I missing some 
> use case?). So I think it would be better if the declaration in 
> the first example would be illegal, since it doesn't really 
> make any sense and is useless.

No.

extern(C) int bar();
@bar() void foo(){}
//pragma(msg, __traits(getAttributes, foo));

void main()
{
     auto x = __traits(getAttributes, foo)[0];
}

is compilable and runnable when linker knows where bar() is.


More information about the Digitalmars-d mailing list