I tried that, it did change output but I came around to similar issues eventually. Apparently Clang does not include the standard library by default (???) and you can't add it like a normal dependency, you have to use compiler/linker flags. So, for my Meson build, the solution was to add:
add_project_arguments(['-lstdc++', '-lm'], language: 'cpp')
add_project_link_arguments(['-lstdc++', '-lm'], language: 'cpp')
to the meson.build file
(-lstdc++ being for most of the std stuff, and -lm for the cmath stuff)