Here's how I'd do it: void main() { const T[] buildArray() { T[] t; // fill in t return t; } const T[] t = buildArray; } So the creation is factored away into that nested function which is used to initialized the reference that you keep around.