[libcxx-commits] [libcxx] [libc++] Workaround clang bug in __has_unique_object_representations (PR #95314)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 17 08:18:56 PDT 2024
================
@@ -22,7 +23,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations
- : public integral_constant<bool, __has_unique_object_representations(_Tp)> {};
+ // TODO: We work around a Clang bug in __has_unique_object_representations by instantiating the
+ // builtin on the non-array type first and discarding that. This is issue #95311.
+ // This workaround can be removed once the bug has been fixed in all supported Clangs.
+ : public integral_constant<bool,
+ ((void)__has_unique_object_representations(remove_all_extents_t<_Tp>),
+ __has_unique_object_representations(_Tp))> {};
----------------
ldionne wrote:
> Can't we just do __has_unique_object_representations(remove_all_extents_t<_Tp>) instead of the operator, weirdness?
We could, but my idea here was to add the workaround in a way that it could be removed by a mere deletion of code in the future. I can reword the comment and change that.
https://github.com/llvm/llvm-project/pull/95314
More information about the libcxx-commits
mailing list