[libcxx-commits] [PATCH] D97283: [libcxx][type_traits] is_unsigned is false for enum types

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 23 07:17:19 PST 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/include/type_traits:1461
+                                                          !__is_enum(_Tp);
 #endif
 
----------------
FWIW, I would prefer to hew closer to the actual standardese in https://eel.is/c++draft/meta#tab:meta.unary.prop and just use `__is_unsigned(_Tp) && is_arithmetic<_Tp>::value`.

It's also definitely worth opening a discussion with compiler vendors — it'd be great if every compiler's `__is_enum` builtin were updated to reflect the standard semantics, since that is literally the entire point of that builtin. :P



================
Comment at: libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp:99
+  test_is_not_unsigned<NotEmpty>();
+  test_is_not_unsigned<Abstract>();
+
----------------
Surely the test for `is_signed` needs these same updates.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97283



More information about the libcxx-commits mailing list