Fix compiler warnings when compiling with Clang.

Fixes #4997