Possible UDA bug

2013-02-24 Thread jerro
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?

Re: Possible UDA bug

2013-02-24 Thread Maxim Fomin
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

Re: Possible UDA bug

2013-02-24 Thread jerro
Why the fist is wrong? It is a call expression which is acceptable according to the UDA grammar. I'm not saying the syntax in the first example is, or should be, invalid. The reason the second does not compile is because the statement is evaluated at CT, and interpreter cannot evaluate

Re: Possible UDA bug

2013-02-24 Thread Maxim Fomin
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

Re: Possible UDA bug

2013-02-24 Thread jerro
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. So this is actually supposed to work? The documentation says: User Defined

Re: Possible UDA bug

2013-02-24 Thread Steven Schveighoffer
On Sun, 24 Feb 2013 13:03:26 -0500, jerro a...@a.com wrote: 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. So this is actually

Re: Possible UDA bug

2013-02-24 Thread Maxim Fomin
On Sunday, 24 February 2013 at 18:03:29 UTC, jerro wrote: 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. So this is actually

Re: Possible UDA bug

2013-02-24 Thread Timon Gehr
On 02/24/2013 05:04 PM, 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

Re: Possible UDA bug

2013-02-24 Thread Timon Gehr
On 02/24/2013 08:19 PM, Timon Gehr wrote: On 02/24/2013 05:04 PM, 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