[PATCH] D40144: Implement `std::launder`
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 18 12:30:29 PST 2017
EricWF added a comment.
I think we may want a `__launder` function that we can use internally in all dialects.
================
Comment at: include/__config:458
+#if __has_builtin(__builtin_launder)
+#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
+#endif
----------------
These macros should take the negative `_LIBCPP_HAS_NO_BUILTIN_LAUNDER` form to be consistent.
================
Comment at: include/new:260
+{
+ static_assert (!is_function<_Tp>::value, "Can't launder functions" );
+ static_assert (!is_same<void, typename remove_cv<_Tp>::type>::value, "Can't launder cv-void" );
----------------
Typically diagnostics don't start with capitals.
Small nit on the use of a contraction too.
================
Comment at: include/new:261
+ static_assert (!is_function<_Tp>::value, "Can't launder functions" );
+ static_assert (!is_same<void, typename remove_cv<_Tp>::type>::value, "Can't launder cv-void" );
+#ifdef _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
----------------
Since this is C++17 only, we can use the `trait_t` and `trait_v` versions to be less verbose.
https://reviews.llvm.org/D40144
More information about the cfe-commits
mailing list