Possible UDA bug
Maxim Fomin
maxim at maxim-fomin.ru
Sun Feb 24 08:25:58 PST 2013
On Sunday, 24 February 2013 at 16:04:19 UTC, jerro wrote:
> This code currently compiles:
>
> int bar();
> @bar() void foo(){}
>
> But this gives an error, as expected:
>
> int bar();
> @bar() void foo(){}
> pragma(msg, __traits(getAttributes, foo));
>
> I would expect the first example to give an error too. Is the
> current behavior deliberate or is it a DMD bug?
Why the fist is wrong? It is a call expression which is
acceptable according to the UDA grammar. 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.
More information about the Digitalmars-d
mailing list