@@ -4170,7 +4170,26 @@ unittest
41704170 // For compilation of immutable lightScope overload with auto return type inference
41714171 alias R = typeof (x.lightScope);
41724172 // Ensure `R` is a Slice
4173- static assert (is (T : Slice! (Iterator, 2 , Contiguous), Iterator));
4173+ static assert (is (R : Slice! (Iterator, 2 , Contiguous), Iterator));
41744174 // Ensure staticMap working properly
41754175 static assert (is (R.Labels[0 ] == staticMap! (LightImmutableOfLightConstOf, int * )[0 ]));
41764176}
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 ]));
4195+ }
0 commit comments