@@ -4163,14 +4163,33 @@ version(mir_ndslice_test)
41634163unittest
41644164{
41654165 import mir.ndslice.slice: LightImmutableOfLightConstOf, Slice, Contiguous;
4166- import std.meta : staticMap;
4167- // Make `x` immutable with label to ensure trigger of staticMap with immutable lightScope overload
4168- alias T = Slice! (int * , 2 , Contiguous, int * );
4169- immutable T x = T.init;
4170- // For compilation of immutable lightScope overload with auto return type inference
4171- alias R = typeof (x.lightScope);
4172- // Ensure `R` is a Slice
4173- static assert (is (T : Slice! (Iterator, 2 , Contiguous), Iterator));
4174- // Ensure staticMap working properly
4175- static assert (is (R.Labels[0 ] == staticMap! (LightImmutableOfLightConstOf, int * )[0 ]));
4166+ import std.meta : staticMap;
4167+ // Make `x` immutable with label to ensure trigger of staticMap with immutable lightScope overload
4168+ alias T = Slice! (int * , 2 , Contiguous, int * );
4169+ immutable T x = T.init;
4170+ // For compilation of immutable lightScope overload with auto return type inference
4171+ alias R = typeof (x.lightScope);
4172+ // Ensure `R` is a Slice
4173+ static assert (is (R : Slice! (Iterator, 2 , Contiguous), Iterator));
4174+ // Ensure staticMap working properly
4175+ static assert (is (R.Labels[0 ] == staticMap! (LightImmutableOfLightConstOf, int * )[0 ]));
4176+ }
4177+
4178+ // Additional test for fix on issue #470
4179+ @safe pure nothrow @nogc
4180+ version (mir_ndslice_test)
4181+ unittest
4182+ {
4183+ import mir.ndslice.slice: LightImmutableOfLightConstOf, Slice, Contiguous;
4184+ import std.meta : staticMap;
4185+ // Make `x` immutable with label to ensure trigger of staticMap with immutable lightScope overload
4186+ alias T = Slice! (int * , 2 , Contiguous, int * , long * );
4187+ immutable T x = T.init;
4188+ // For compilation of immutable lightScope overload with auto return type inference
4189+ alias R = typeof (x.lightScope);
4190+ // Ensure `R` is a Slice
4191+ static assert (is (R : Slice! (Iterator, 2 , Contiguous), Iterator));
4192+ // Ensure staticMap working properly
4193+ static assert (is (R.Labels[0 ] == staticMap! (LightImmutableOfLightConstOf, int * , long * )[0 ]));
4194+ static assert (is (R.Labels[1 ] == staticMap! (LightImmutableOfLightConstOf, int * , long * )[1 ]));
41764195}
0 commit comments