[clang] [clang] Fix underlying type of EmbedExpr (PR #99050)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 06:02:25 PDT 2024


AaronBallman wrote:

> I can add test with sizeof for sure, the problem is that it is already working https://godbolt.org/z/K69v8KPYa and we have similar ones in codebase already. 

Ah, if we have sufficient coverage already, that's fine. I was just thinking about coverage in general, didn't check to see if it was redundant. :-)

> The test I'm struggling with is to check that elements in initializer list that are expanded from embed also have int type.

If you have an embed file with a single byte in it whose value is 0xFF, you could use a test like:
```
struct S {
  signed char ch;
};

constexpr struct S s = {
#embed "foo"
};
```
which should give the same behavior as: https://godbolt.org/z/Tno5YPexM

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


More information about the cfe-commits mailing list