[libcxx-commits] [PATCH] D58987: Make underlying_type SFINAE-friendly
Marshall Clow via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 6 08:49:08 PST 2019
mclow.lists added a comment.
Here's the whole wording (from P0340):
> template <class T>
> struct underlying_type;
>
>
> If `T` is an enumeration type, the member typedef `type` names the underlying type of T (9.6 [dcl.enum]); otherwise, there is no member `type`.
>
> Mandates: `T` shall be a is not an incomplete enumeration type. (9.6)
So you'll need a test of an incomplete enumeration type.
================
Comment at: include/type_traits:4714
-template <class _Tp>
+template <class _Tp, bool = is_enum<_Tp>::value>
struct underlying_type
----------------
I think I'd rather bury the boolean in an `__impl` class.
================
Comment at: test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp:66
+#if TEST_STD_VER > 17
+ test_sfinae(0);
+#endif // TEST_STD_VER > 17
----------------
I prefer a failing test; so that we can look at the error message: `no type named type in std::underlying_type<int>` blah blah.
Repository:
rCXX libc++
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58987/new/
https://reviews.llvm.org/D58987
More information about the libcxx-commits
mailing list