ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.06k stars 437 forks source link

Currently not possible to compile range-v3 with -fno-exceptions flag set #1763

Open yury-fedorov opened 1 year ago

yury-fedorov commented 1 year ago

Adding -fno-exceptions as a compilation flag into a project dependent from range-v3 leads to the following errors:

range-v3-src/include/meta/meta.hpp:410:35: error: cannot use 'throw' with exceptions disabled throw "The start of the integer_sequence must not be " range-v3-src/include/range/v3/detail/variant.hpp:455:17: error: cannot use 'throw' with exceptions disabled throw bad_variant_access("bad variant access"); range-v3-src/include/range/v3/view/interface.hpp:314:17: error: cannot use 'throw' with exceptions disabled throw std::out_of_range("view_interface::at"); range-v3-src/include/range/v3/view/interface.hpp:327:17: error: cannot use 'throw' with exceptions disabled throw std::out_of_range("view_interface::at"); range-v3-src/include/range/v3/utility/optional.hpp:79:13: error: cannot use 'throw' with exceptions disabled throw bad_optional_access{}; range-v3-src/include/range/v3/range/operations.hpp:53:53: error: cannot use 'throw' with exceptions disabled throw std::out_of_range("ranges::at")

melg8 commented 1 year ago

Also encountered same issue with line: throw bad_variant_access("bad variant access"); it would be nice to have something like define switch to change behaviour of this places into other than exception way to report issue. Not that many places in library actually throw. @yury-fedorov did you endup with any sort of workarounds?