[PATCH] D116203: [clang] adds unary type transformations as compiler built-ins

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 7 09:55:38 PDT 2022

aaron.ballman added a comment.

In D116203#3436572 <https://reviews.llvm.org/D116203#3436572>, @cjdb wrote:

> Having `__remove_cv` do more than it's advertised to do doesn't sound like a great idea to me. Both libc++ <https://github.com/llvm/llvm-project/blob/main/libcxx/include/type_traits#L647> and libstdc++ <https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/type_traits#L1561> define `std::remove_cv` without extensions, and I think it would be surprising for `__remove_cv` to remove anything else.
> I'm not against adding `__remove_restrict`, `__remove_qualifiers` (although "qualifier" could imply ref-qualifiers too?), etc.. I suppose that in the rare case someone wants to remove `volatile restrict` and keep `const&`, it's possible to do `__add_const(__remove_qualifiers(T)&)`.

Sorry, I was really unclear it seems. I was recommending we end up with:

`__remove_cv`  // Removes just `const` and `volatile`
`__remove_qualifiers` // Removes all qualifiers

and if we someday find a use for adding `__remove_cvr` we can add it (but I would be surprised if the need was that great).

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list