On Tuesday, 8 October 2013 at 20:59:04 UTC, Matt Soucy wrote:
Update on this - unfortunately, I discovered that this doesn't
seem to work for any members, due to requiring a specific
"this". I can't quite figure out why though...
Try adding static to the helper functions in the templates. I
just did that and this worked:
struct Whoa {
int a;
}
class Foo {
@lol void argh() {}
@Whoa(12) int keanu;
}
void main() {
pragma(msg, hasAnnotation!(Foo.argh, lol));
pragma(msg, getAnnotation!(Foo.keanu, Whoa));
}
~$ dmd test34
true
Whoa(12)
The change to get it to compile was just this:
template hasValueAnnotation(alias f, Attr) {
static bool helper() { // added static
and so on for all three of the helper functions, just make them
all static.