[libcxx-commits] [libcxx] [libc++] Use remove_pointer builtin as library traits (PR #91838)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 16 18:55:37 PDT 2024


Chilledheart wrote:

> > > I agree that it doesn't make a ton of sense to guard this on the version, since the GCC folks make it very clear that they don't intend to support the use of the builtin directly.
> > 
> > 
> > For type traits, no. It is because type traits structure doesn't require demangle names. For value traits, yes. They are using the builtin directly to avoid intermediate symbols.
> > We have the same issues with `__add_pointer` as well where there're lacking structure used for type alias.
> 
> GCC doesn't mangle any of the builtin type traits, so you can't use `__is_whatever` directly either. You have to go through either a class template or a variable template. Both have their own mangling, while an alias template doesn't.
> 
> > > We should simply resolve the `__remove_pointer_t` alias to either `remove_pointer<>::type` for GCC or `__remove_pointer()` for Clang.
> > 
> > 
> > It's up to you. You're the maintainer. But that reason doesn't convince me because it makes things complex especially the patch. As a user of libc++, I want things go upstream because it makes maintainment easier without introducing some complex code.
> 
> I'm not sure why you think this makes the patch complex. That's like four lines of code.

I don't like that patch. If you want to make it, make it.
 
Finnaly, you will have to add 4x14 lines code at least, see https://github.com/llvm/llvm-project/issues/91831#issuecomment-2105592054. For other type traits, it can be even more complex.

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


More information about the libcxx-commits mailing list