llvm-project
d4efbf10 - [Clang][ExprConst] Handle APValue::LValue in BitCast (#184865)

Commit
48 days ago
[Clang][ExprConst] Handle APValue::LValue in BitCast (#184865) Instead of marking the branch unreachable, emit an unsupported type diagnostic and return false when encountering `APValue::LValue` in `APValueToBufferConverter`. A good example of this is: ``` long fn() { return __builtin_bit_cast(long, (long)&fn); } ``` Although `&fn` itself is a pointer type, the cast `(long)` converts it to an integer type, which passes `checkBitCastConstexprEligibilityType`. Thus, eventually, we see it in Converter, which does not expect an LValue. Fixes https://github.com/llvm/llvm-project/issues/44991
Author
Parents
Loading