test83
auto test83 =
q{--- test83
// using enum as array size
// constant folding in static expressions
// test forward references too
// use static array length in constant folded expression
enum combined_enums = cast(u64)arr_size3 + arrBackref.length;
i32[combined_enums] arrBackrefX;
u64 combinedEnums() { return arrBackrefX.length; } // 16
enum arr_size = 4;
i32[arr_size] arrBackref;
u64 getSize1() { return arrBackref.length; } // 4
u64 testBackref() {
i32[arr_size] local_arr;
return local_arr.length; // 4
}
i32[arr_size2] arrForwardref;
u64 getSize2() { return arrForwardref.length; } // 7
u64 testForwardref() {
i32[arr_size2] local_arr;
return local_arr.length; // 7
}
enum arr_size2 = 7;
i32[arr_size3 + 4] arrForwardref2;
u64 getSize3() { return arrForwardref2.length; } // 16
u64 testForwardref2() {
i32[arr_size3 + 10] local_arr;
return local_arr.length; // 22
}
enum arr_size3 = 12;
};
tests passing
functionsvariables