I'm trying to debug a compilation problem: the generic parameter of a proc
doesn't seem to match my expectation, so I'd like to write something like this:
let b: byte = 42'u8
proc test*[T](t: T): bool =
if sizeof(T) == 1:
result = true # ...
else:
{.error: "invalid parameter size: " & $sizeof(T).}
test(b)
But the compiler returns this:
Error: invalid pragma: error: "invalid parameter size: " & $ sizeof(T)
I tried searching in the Nim codebase, but found no example. So is it
impossible?
find . -name "*.nim" | xargs fgrep "{.error"