[libcxx-commits] [PATCH] D145376: [libc++] add declval failure assertion for instantiation

Igor Zhukov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 6 21:05:58 PST 2023


fsb4000 added inline comments.


================
Comment at: libcxx/include/__utility/declval.h:29
 
-template <class _Tp>
-decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT;
+template <class _Tp, bool _False = false>
+_LIBCPP_HIDE_FROM_ABI decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT {
----------------
frederick-vs-ja wrote:
> I think it's better not to modify the template head.
> Doesn't libc++ have a concentrated `__dependent_false`? If so, I think we can still use `!__is_same(_Tp, _Tp)` in `static_assert`.
I found that pattern there: https://github.com/llvm/llvm-project/blob/90f6a4cc73d5c40add913e6ed5d34a7a9db58c79/libcxx/include/__compare/common_comparison_category.h#L63-L79


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

https://reviews.llvm.org/D145376



More information about the libcxx-commits mailing list