[libcxx-commits] [PATCH] D65034: [libc++] use constexpr for sizeof comparisons
Alan Somers via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 22 11:03:39 PDT 2019
asomers marked an inline comment as done.
asomers added inline comments.
================
Comment at: include/functional:1769
_FunAlloc __af(__a);
- if (sizeof(_Fun) <= sizeof(__buf_) &&
+ if _LIBCPP_CONSTEXPR_AFTER_CXX14(sizeof(_Fun) <= sizeof(__buf_) &&
is_nothrow_copy_constructible<_Fp>::value &&
----------------
ldionne wrote:
> The purpose of `_LIBCPP_CONSTEXPR_AFTER_CXX14` isn't to be used that way, it's meant for Standard Library facilities that were marked `constexpr` in C++17. I think we should have a macro specifically for constructing an `if constexpr` when supported.
How about something like this:
```
#ifdef __cpp_if_constexpr
#define __IF_CONSTEXPR constexpr
#else
#define __IF_CONSTEXPR
#endif
```
Repository:
rCXX libc++
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65034/new/
https://reviews.llvm.org/D65034
More information about the libcxx-commits
mailing list