martinus / nanobench

Simple, fast, accurate single-header microbenchmarking functionality for C++11/14/17/20
https://nanobench.ankerl.com
MIT License
1.43k stars 82 forks source link

Workaround missing `noexcept` for std::string move assignment #87

Closed cj-tommi-rantala closed 1 year ago

cj-tommi-rantala commented 1 year ago

Due to GCC/libstdc++ bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58265 the string move assignment may be missing noexcept, resulting in build errors even with relative recent GCC versions:

nanobench.h:2898:9: error: function 'ankerl::nanobench::Config& ankerl::nanobench::Config::operator=(ankerl::nanobench::Config&&)' defaulted on its redeclaration with an exception-specification that differs from the implicit exception-specification ''
 Config& Config::operator=(Config&&) noexcept = default;
         ^~~~~~

Hit this with some GCC 7.5.0 based cross toolchain, and for me it's locally reproducible (in Ubuntu) with g++-8 -D_GLIBCXX_USE_CXX11_ABI=0 ...

martinus commented 1 year ago

Thanks!