Fixed compilation error with clang.

Fixes a compilation error under macos.

cherry picked from https://github.com/bitcoin/bitcoin/pull/1875. kudos!