nlohmann / fifo_map

a FIFO-ordered associative container for C++
MIT License
179 stars 77 forks source link

catching polymorphic type ‘class std::out_of_range’ by value #15

Closed spineight closed 2 years ago

spineight commented 2 years ago

Using the library with these compiler flags: target_compile_options(unit PUBLIC -Werror -Wall -Wextra)

raises the error: /fifo_map/test/unit.cpp:62:41: error: catching polymorphic type ‘class std::out_of_range’ by value [-Werror=catch-value=] 62 | CHECK_THROWS_AS(m.at("Z"), std::out_of_range); | ^~~~ /fifo_map/test/unit.cpp:68:42: error: catching polymorphic type ‘class std::out_of_range’ by value [-Werror=catch-value=] 68 | CHECK_THROWS_AS(mc.at("Z"), std::out_of_range);

I have made a PR to address this: https://github.com/nlohmann/fifo_map/pull/14