[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t lit… (PR #136542)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 21 08:20:36 PDT 2025


erichkeane wrote:

>I don't think we can do that, at least for C, because that means this code would then be accepted when it shouldn't be, right?

Yeah, I am not sure we can do this now then.  It seems odd to allow calls to builtins to change their return 'type' (or at least, return sugar) based on when they are included.  Even if we did, we would have to make sure it actually WAS SIZE_TYPE and not a different typedef.

So I guess we're back to: are we ok with this?

```
sizeof(int); // returns an unsigned integer type
#include <stddef.h>
sizeof(int); // now returns a typedef to an unsigned integer type
```

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


More information about the cfe-commits mailing list