non static error in Precision RTL
You can't do variable slicings in synthesis, because the expression has no preknown range and size. Even if allowed in subexpressions, it's hard to ensure that all subexpressions together meet the LHS constraints for every possible input.

And a further question would be: What's the resulting hardware for that construct? A very big ROM?

You need to convert your code to


a multiplexer or
mask + shift operations