span-lite
span-lite copied to clipboard
Inconsitent behaviors with C array and make_span return type
Hello, please see the following:
static_assert(std::is_same<decltype(make_span(std::declval<int[5]>())),span<const int>>::value, "make_span Broken");
static_assert(std::is_same<decltype(make_span(std::declval<int(&)[5]>())),span<int,5>>::value, "make_span Broken");
static_assert(std::is_same<decltype(make_span(std::declval<const int[5]>())),span<const int,5>>::value, "make_span Broken");
static_assert(std::is_same<decltype(make_span(std::declval<const int(&)[5]>())),span<const int,5>>::value, "make_span Broken");
The first case returns a span with dynamic extent, while the other 3 return a span with a fixed size extent.
While non-const rvalue reference to C arrays almost never appear anywhere, this is a minor inconsistency and looks like a bug?
Above code in Compiler explorer.