[libcxx-commits] [PATCH] D115100: [libc++] Enable the optimized _IsSame on GCC as well as Clang.

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 6 08:39:26 PST 2021


jloser added inline comments.


================
Comment at: libcxx/include/type_traits:563
+// is_same<A,B> and is_same<C,D> are guaranteed to be different types, but
+// _IsSame<A,B> and _IsSame<C,D> are the same type (namely, false_type).
+// If we ever need to support a compiler without the __is_same builtin,
----------------
Any appetite for adding a `libcxx` test for this behavior? It is a "private" type trait, but useful property in helping compile times, so I think a simple test doesn't hurt.


================
Comment at: libcxx/include/type_traits:936
 
+struct __two {char __lx[2];};
+
----------------
Why move this below the `// is_class` comment? It's a standalone helper type unrelated to `is_class` AFAICT, right? I recommend moving it above the `// is_class` comment. Maybe even add the `// helper class:` comment above the `struct __two {char __lx[2];};`.

Alternatively, revert the diff entirely as it's not needed for this patch. :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115100/new/

https://reviews.llvm.org/D115100



More information about the libcxx-commits mailing list