pasta icon indicating copy to clipboard operation
pasta copied to clipboard

Investigate revertible type traits

Open pgoodman opened this issue 2 years ago • 0 comments

https://github.com/llvm/llvm-project/blob/3af4590506634fa176be5cb5f53161f96609730c/clang/lib/Parse/ParseExpr.cpp#L1071

This works:

template <bool>
struct _BoolConstant {};

#if __has_builtin(__is_destructible)
template <class _Tp>
struct is_destructible : _BoolConstant<__is_destructible(_Tp)> {};
#endif

But this doesn't:

template <bool>
struct _BoolConstant {};

template <class _Tp>
struct is_destructible : _BoolConstant<__is_destructible(_Tp)> {};

This suggests there may be something stateful involved with __is_destructibe showing up first in the __has_builtin.

pgoodman avatar Sep 05 '23 18:09 pgoodman