Sample vertex shader:
#version 450
layout(constant_id = 0) const uint a = 1;
layout(location = 0) out uint o;
void main() {
uint arr[a+a];
arr[0] = 1;
arr[1] = 2;
o = arr[1];
}
compiling to generate SPIR-V, I get this:
$glslangValidator -V c.vert -o c.spv
c.vert
ERROR: c.vert:9: '[' : array index out of range '1'
ERROR: c.vert:9: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
Given that the spec constant is not known at compile time, it's too aggressive to error out saying that an array index of 1 is out of range.