[libcxx-commits] [PATCH] D97283: [libcxx][type_traits] is_unsigned is false for enum types
Tomas Matheson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 23 06:31:39 PST 2021
tmatheson created this revision.
tmatheson requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Enum types are not arithmetic, therefore both is_arithmetic and is_unsigned
should be false for them. This change fixes the implementation of is_unsigned
(which was returning true for enums) and adds some more tests. Also adds a test
for enum class to is_arithmetic.
Note that std::is_unsigned is based on the implementation of __is_unsigned,
which returns true for enum types. To avoid introducing version differences
between libcxx and clang, the implementation of __is_unsigned is left unchanged
here, and an explicit check for __is_enum is added to the implementation of
is_unsigned instead.
clang-format to pass the linter.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97283
Files:
libcxx/include/type_traits
libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp
libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97283.325768.patch
Type: text/x-patch
Size: 4100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210223/afff19a1/attachment.bin>
More information about the libcxx-commits
mailing list