cpp_tests: no need for dynamic_cast
handle lacking return value handling caught by coverity