[clang] [Clang] Fixed an assertion in constant evaluation of EmbedExpr inside array initializers. (PR #182257)

Aadarsh Keshri via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 22 01:56:48 PST 2026


Aadarsh-Keshri wrote:

> An interesting thing I found while compiling the test cases: While this test case gives `` Assertion `DestTy->isFloatingType() && "unexpected type"' `` failure (https://godbolt.org/z/rorY1E5To) :
> 
> ```c
> void *bad_ptr = (int*[]){
> #embed __FILE__ 
> }; 
> ```
> 
> The compound_float test case gives `` Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' `` failure (https://godbolt.org/z/9K6r4s4GG):
> 
> ```c
> void *complexfloat = (_Complex float[]){
> #embed __FILE__
> };
> ```

Though both of them go away with the change I introduced in this PR.
I'll try to work on implementing the suggested solution now

https://github.com/llvm/llvm-project/pull/182257


More information about the cfe-commits mailing list