Can function constants be used to declare array length?

I was surprised to encounter the following error when defining an array length...


constant int sd_len_fc [[function_constant(0)]];
constant int sd_len = is_function_constant_defined(sd_len_fc) ? sd_len_fc : 512;
<...>
threadgroup float4 sharedData[sd_len];
<...>

<program source>:47:38: error: variable length arrays are not supported in Metal
        threadgroup float4 sharedData[sd_len];


Is it not possible to define the length of an array using a function constant?


I expected something like array lengths to be resolved in the final pipeline compile stage, not during source code compile.


Am I just missing something? Or is this just an oversight and I should file an enhancement request? Or is this something inherent to the operation of MSL compilation?