[libcxx-commits] [PATCH] D58987: Make underlying_type SFINAE-friendly

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 6 13:47:39 PST 2019


zoecarver marked 5 inline comments as done.
zoecarver added inline comments.


================
Comment at: include/type_traits:4714
 
-template <class _Tp>
+template <class _Tp, bool = is_enum<_Tp>::value>
 struct underlying_type
----------------
EricWF wrote:
> mclow.lists wrote:
> > I think I'd rather bury the boolean in an `__impl` class.
> +1. We shouldn't change the top-level declaration like this. It's technically an ABI break.
Will do.


================
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
----------------
EricWF wrote:
> mclow.lists wrote:
> > 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.
> Why not both? Passing tests are nice too.
The failing test error would be
> no matching function for call to 'test_sfinae'
There would be a note:
> candidate template ignored: substitution failure [with T = int]: no type named 'type' in 'std::__1::underlying_type<int>'
Is there any way to test for the note too?

I will add both.


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