The limitation to POD types stems from the times when our constant emission
logic was way less sophisticated and much more buggy. Emit all constant
initializers as LLVM constants.
This reuses the logic for static vars, so assert that we don't accidentally
introduce a static initializer. I tried to cover the issues mentioned in the
commit with additional test cases.
There are still cases that isConstantInitializer gets wrong. For instance, we don't check that the array filler is a constant for an array InitListExpr:
(You can see that there's a problem here because we emit dynamic initialization code but no -Wglobal-constructors warning.)
(Unrelated to your change) The bitfield case is still broken; this asserts: