The behavior you observe is a result of a compiler bug, which is fixed in newer versions of Clang. I can reproduce the behavior with clang 16 on Linux/x86. Clang 17 produces the correct and expected results. Your best option is to switch to an up-to-date compiler.