ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.05k stars 373 forks source link

etl::private_variant doesn't fully respect the chosen error reporting. #795

Closed HMS-JJO closed 7 months ago

HMS-JJO commented 7 months ago

Hi,

When using etl::variant with C++11 enabled, the internal function

etl::private_variant::operation_type<T, Non_Copyable, Moveable>::do_operation(int, char*, const char*)

reports errors using a plain assert(false); when ETL_DEBUG is defined.

I believe this is an error since all other assert(false); in this context is enabled when ETL_IN_UNIT_TEST is defined, and this single one is enabled when ETL_DEBUG is defined.

This causes an error in my environment where assert isn't available, and where I would like errors to be reported by defining ETL_LOG_ERRORS and setting an error handler via etl::error_handler::set_callback.

In etl version 20.38.6 the offending code is at include/etl/private/variant_variadic.h lines 230-232.

jwellbelove commented 7 months ago

Fixed 20.38.8