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

[libc++][mdspan] Fix extents CTAD #68737

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/include/__mdspan/extents.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ using dextents = typename __mdspan_detail::__make_dextents<_IndexType, _Rank>::t

// Deduction guide for extents
template <class... _IndexTypes>
extents(_IndexTypes...) -> extents<size_t, size_t((_IndexTypes(), dynamic_extent))...>;
extents(_IndexTypes...) -> extents<size_t, size_t(((void)sizeof(_IndexTypes), dynamic_extent))...>;

namespace __mdspan_detail {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
#include "../ConvertibleToIntegral.h"
#include "test_macros.h"

struct NoDefaultCtorIndex {
size_t value;
constexpr NoDefaultCtorIndex() = delete;
constexpr NoDefaultCtorIndex(size_t val) : value(val){};
constexpr operator size_t() const noexcept { return value; }
};

template <class E, class Expected>
constexpr void test(E e, Expected expected) {
ASSERT_SAME_TYPE(E, Expected);
Expand All @@ -35,6 +42,7 @@ constexpr bool test() {
test(std::extents(1, 2u), std::extents<std::size_t, D, D>(1, 2u));
test(std::extents(1, 2u, 3, 4, 5, 6, 7, 8, 9),
std::extents<std::size_t, D, D, D, D, D, D, D, D, D>(1, 2u, 3, 4, 5, 6, 7, 8, 9));
test(std::extents(NoDefaultCtorIndex{1}, NoDefaultCtorIndex{2}), std::extents<std::size_t, D, D>(1, 2));
return true;
}

Expand Down