Closed nmm0 closed 1 year ago
Input that fails:
static_assert(Kokkos::extents<size_t, Kokkos::dynamic_extent, 4>{ 7, 4 }.extent( 0 ) == 7);
Note that this works fine in C++20 mode.
Example compile error with gcc-12 and C++17 mode:
mdspan/include/mdspan/../experimental/__p0009_bits/extents.hpp:419:9: error: 'constexpr Kokkos::detail::maybe_static_array<TDynamic, TStatic, dyn_tag, Values>::maybe_static_array(DynVals ...) [with DynVals = {long unsigned int, long unsigned int}; typename std::enable_if<((sizeof... (DynVals) != m_size_dynamic) && (m_size_dynamic > 0)), int>::type <anonymous> = 0; TDynamic = long unsigned int; TStatic = long unsigned int; TStatic dyn_tag = 18446744073709551615; TStatic ...Values = {18446744073709551615, 4}]' called in a constant expression 419 | : m_vals(static_cast<index_type>(dynvals)...) {} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mdspan/include/mdspan/../experimental/__p0009_bits/extents.hpp:268:13: note: 'constexpr Kokkos::detail::maybe_static_array<TDynamic, TStatic, dyn_tag, Values>::maybe_static_array(DynVals ...) [with DynVals = {long unsigned int, long unsigned int}; typename std::enable_if<((sizeof... (DynVals) != m_size_dynamic) && (m_size_dynamic > 0)), int>::type <anonymous> = 0; TDynamic = long unsigned int; TStatic = long unsigned int; TStatic dyn_tag = 18446744073709551615; TStatic ...Values = {18446744073709551615, 4}]' is not usable as a 'constexpr' function because: 268 | constexpr maybe_static_array(DynVals... vals) { | ^~~~~~~~~~~~~~~~~~ mdspan/include/mdspan/../experimental/__p0009_bits/extents.hpp:268:13: error: member 'Kokkos::detail::maybe_static_array<long unsigned int, long unsigned int, 18446744073709551615, 18446744073709551615, 4>::m_dyn_vals' must be initialized by mem-initializer in 'constexpr' constructor mdspan/include/mdspan/../experimental/__p0009_bits/extents.hpp:207:7: note: declared here 207 | m_dyn_vals; | ^~~~~~~~~~
Input that fails:
Note that this works fine in C++20 mode.
Example compile error with gcc-12 and C++17 mode: