[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:37:02 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) :
`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):
`void *complexfloat = (_Complex float[]){
#embed __FILE__
};`
And there are no assertion failures in case of struct, enum or local variable test cases (https://godbolt.org/z/43exhaK7d):
`struct S { int x; };
struct S *bad_struct = (struct S[5]){
#embed __FILE__
};
enum E { A };
enum E *bad_enum = (enum E[5]){
#embed __FILE__
};
void f(void) {
void *bad_ptr=(int*[]){
#embed __FILE__
}
}`
https://github.com/llvm/llvm-project/pull/182257
More information about the cfe-commits
mailing list