Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/include/__type_traits/decay.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__decay)
#if __has_builtin(__decay) && !defined(_LIBCPP_COMPILER_GCC)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the GCC-provided builtin incompatible with Clang's?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCC doesn't mangle the builtin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so do we need to do something like

template <class _Tp>
struct __decay_impl {
  using type = __builtin_decay_t(_Tp);
};

template <class _Tp>
using __decay_t = typename __decay_impl<_Tp>::type;

?

Copy link
Author

@killcerr killcerr Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use the same way in similar issue
to fix this issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, something like that. I'd probably just use decay as the base (i.e. using __decay_t = decay<T>::type) for GCC.

template <class _Tp>
using __decay_t _LIBCPP_NODEBUG = __decay(_Tp);

Expand Down
Loading