Fix build errors with Clang and MSVC