auto a = [1, 2, 3].staticArray; static assert(is(typeof(a) == int[a.length])); static assert(is(typeof([1, 2, 3].staticArray) == int[a.length])); auto b = "hello".s; static assert(is(typeof(b) == char[5])); auto x = s!ubyte(1, 2, 3); static assert(is(typeof(x) == ubyte[3]));
non-copyable element type in static array
auto b = [US(42)].s; static assert(b.length == 1);
auto x = [1, 2, 3].staticArray; static assert(is(typeof(x) == int[x.length])); static assert(is(typeof([1, 2, 3].staticArray) == int[x.length])); static assert(!__traits(compiles, { static int[] doNotDoThat() { return [1, 2, 3].s; } }));