In stead of using void cast, move declaration into ifdef block

Missed the original pull request by a minute.