C++: clang fixes (rebased)

Rebased from https://github.com/openmicroscopy/openmicroscopy/pull/2276