Re: delegate passed in annotation struct cannot be invoked.

2016-12-30 Thread Alexandru Ermicioi via Digitalmars-d-learn
On Thursday, 29 December 2016 at 21:29:47 UTC, Stefan Koch wrote: ldc accepts invalid code there. But it might be that dmd 2.071.2 did that as well. If so It will be fixed as soon as ldc updates the front-end version. Nope, tried with dmd v2.071.2 and it gives same error as v2.072.1. I think

Re: delegate passed in annotation struct cannot be invoked.

2016-12-29 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 29 December 2016 at 21:19:18 UTC, Alexandru Ermicioi wrote: On Thursday, 29 December 2016 at 21:07:00 UTC, Stefan Koch wrote: It's a delegate and not function. Therefore it will get a frame-ptr regardless, without checking if it is needed or not, or if there is a frame to point

Re: delegate passed in annotation struct cannot be invoked.

2016-12-29 Thread Alexandru Ermicioi via Digitalmars-d-learn
On Thursday, 29 December 2016 at 21:07:00 UTC, Stefan Koch wrote: It's a delegate and not function. Therefore it will get a frame-ptr regardless, without checking if it is needed or not, or if there is a frame to point to. Since there is no frame to point to you get the error. At least this is

Re: delegate passed in annotation struct cannot be invoked.

2016-12-29 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 29 December 2016 at 20:55:43 UTC, Alexandru Ermicioi wrote: Given code below: import std.stdio; struct Annotation { public int delegate(int) dg; } void main() { import std.traits; __traits(getAttributes, Cls)[0].dg(20).writeln; } @Annotation(delegate

delegate passed in annotation struct cannot be invoked.

2016-12-29 Thread Alexandru Ermicioi via Digitalmars-d-learn
Given code below: import std.stdio; struct Annotation { public int delegate(int) dg; } void main() { import std.traits; __traits(getAttributes, Cls)[0].dg(20).writeln; } @Annotation(delegate int(int d) { return d; }) class Cls { void method() { } }