diff --git a/gsl/multi_span b/gsl/multi_span index d91f02a..479b074 100644 --- a/gsl/multi_span +++ b/gsl/multi_span @@ -1488,7 +1488,7 @@ public: constexpr reference operator()(FirstIndex index, OtherIndices... indices) { index_type idx = {narrow_cast(index), - narrow_cast(indices...)}; + narrow_cast(indices)...}; return this->operator[](idx); } diff --git a/tests/multi_span_tests.cpp b/tests/multi_span_tests.cpp index 8dbe151..0c17944 100644 --- a/tests/multi_span_tests.cpp +++ b/tests/multi_span_tests.cpp @@ -941,8 +941,17 @@ SUITE(multi_span_tests) { multi_span s = arr2d; CHECK(s(0, 0) == 1); + CHECK(s(0, 1) == 2); CHECK(s(1, 2) == 6); } + + int arr3d[2][2][2] = {1, 2, 3, 4, 5, 6, 7, 8}; + + { + multi_span s = arr3d; + CHECK(s(0, 0, 0) == 1); + CHECK(s(1, 1, 1) == 8); + } } TEST(comparison_operators)