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

John McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 23 11:58:22 PDT 2025


rjmccall wrote:

> > At least, it must ensure that `__size_t` is equivalent to `size_t` and generates the same mangled name.
> 
> Is that possible? @rjmccall

If `size_t` is a different type from `__size_t`, then `void foo(size_t);` declares a different entity from `void foo(__size_t);`. The two functions therefore must be mangled differently in order to allow them to coexist in the program. The same rule applies consistently to template specializations and everywhere else a type can be written.

The result is that, no, this is not possible. If you want two types to mangle the same way, you are really saying that they are the same type. This is relationship between a type and a sugaring of the type, not the relationship between two different types that share a representation.

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


More information about the cfe-commits mailing list