[PATCH] D48292: use modern type trait implementations when available

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 17:11:53 PDT 2019


rsmith marked an inline comment as done.
rsmith added inline comments.


================
Comment at: include/type_traits:3683
+
+#elif __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)
+
----------------
EricWF wrote:
> We don't support anything before GCC 4.9, so you can replace the GCC guard with `|| defined(_LIBCPP_COMPILER_GCC)`
Nice. I'll do this more broadly as a separate patch, if that's OK with you. There's lots of support for older GCCs scattered around in this file and elsewhere.


================
Comment at: include/type_traits:3710
 
-#if 0
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
----------------
EricWF wrote:
> We should use variadics in C++03 when Clang is the compiler.  I would write this check as `#if !defined(_LIBCPP_CXX03_LANG) || defined(__clang__)`
Would it make more sense to change the definition of _LIBCPP_HAS_NO_VARIADICS to do that globally? This same pattern is used in various places in libc++, both in existing code in `<type_traits>`, in `<future>` (for `packaged_task` / `async`), and in `<memory>` (for traits and `allocator::construct`). In every case we're guarding use of variadics to define a template that is specified as being variadic.


================
Comment at: include/type_traits:3718
 
-#else
+#elif __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
 
----------------
EricWF wrote:
> At this point I believe `#elif !defined(_LIBCPP_CXX03_LANG)` should work.
I'll do that as part of the GCC4.9 change.   


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D48292





More information about the cfe-commits mailing list