Seems like a bug. Pragmas should probably only be triggered for proc implementations.
Either it's a bug in Nim because it triggers pragmas for forward declared proc or it's a bug in memoize which should detect that it's called in a forward-declared context (how?). My finger would be, you are the first one to use a custom pragma that modifies a proc body on a forward declared proc. I don't know if there are use case to trigger a pragma on a forward declare proc, if not I think Nim should be updated to not do that so that all the existing macros libraries work on forward declared proc.
