Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsitent behaviors with C array and make_span return type #60

Open
fmatthew5876 opened this issue Aug 18, 2020 · 1 comment
Open

Comments

@fmatthew5876
Copy link

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?

@martinmoene
Copy link
Owner

Above code in Compiler explorer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants