[libcxx-commits] [libcxx] [libc++] Workaround clang bug in __has_unique_object_representations (PR #95314)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 13 00:42:43 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))> {};
----------------
philnik777 wrote:
Can't we just do `__has_unique_object_representations(remove_all_extents_t<_Tp>)` instead of the `operator,` weirdness?
https://github.com/llvm/llvm-project/pull/95314
More information about the libcxx-commits
mailing list