Implement bug 317: use a template function call to suppress unused variable warnings. This also fix the issue of the previous changeset in a much nicer way.