ETLCPP / etl

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

ambiguous `etl::bit_stream_reader::bit_stream_reader()` for some `etl::span` #754

Closed dhebbeker closed 9 months ago

dhebbeker commented 10 months ago

Some template specializations of etl::span can not be passed as argument to etl::bit_stream_reader::bit_stream_reader().

When passing as argument to the constructor:

<source>:19:82: error: call of overloaded 'bit_stream_reader(const etl::span<const unsigned char>&, etl::endian::enum_type)' is ambiguous
   19 |     ETL_STATIC_CONSTANT etl::bit_stream_reader bits(bit_span, etl::endian::little);
      |                                                                                  ^
In file included from <source>:1:
/opt/compiler-explorer/libs/etl/include/etl/bit_stream.h:1045:5: note: candidate: 'etl::bit_stream_reader::bit_stream_reader(etl::span<unsigned char>, etl::endian)'
 1045 |     bit_stream_reader(etl::span<unsigned char> span_, etl::endian stream_endianness_)
      |     ^~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/etl/include/etl/bit_stream.h:1034:5: note: candidate: 'etl::bit_stream_reader::bit_stream_reader(etl::span<char>, etl::endian)'
 1034 |     bit_stream_reader(etl::span<char> span_, etl::endian stream_endianness_)
      |     ^~~~~~~~~~~~~~~~~

See this example on Compiler Explorer using:

dhebbeker commented 10 months ago

I already reported this here in Slack and I know that @jwellbelove has confirmed it. I just want to make sure the report does not get lost because of the Slack workspace plan in order.

Also this way others have a chance to avoid duplicate reports.

jwellbelove commented 9 months ago

Fixed 20.38.2