The ugly solution is to use static if like so: static if(isIntegral!V) { unittest { } } But that is, well, ugly.
I found a less ugly solution -- remove the braces: static if(isIntegral!V) unittest { ... } This is probably fine for most purposes. I'd still like the non-generic unit test near the function declaration. -Steve