Skip to content

Commit 798bb80

Browse files
committed
Use && 0 and add a comment
1 parent 6da2fc4 commit 798bb80

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libcxx/include/__type_traits/is_trivially_relocatable.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222

2323
// A type is trivially relocatable if a move construct + destroy of the original object is equivalent to
2424
// `memcpy(dst, src, sizeof(T))`.
25+
//
26+
// Note that we don't use the __is_trivially_relocatable Clang builtin right now because it does not
27+
// implement the semantics of any current or future trivial relocation proposal and it can lead to
28+
// incorrect optimizations on some platforms (Windows) and supported compilers (AppleClang).
29+
#if __has_builtin(__is_trivially_relocatable) && 0
30+
template <class _Tp, class = void>
31+
struct __libcpp_is_trivially_relocatable : integral_constant<bool, __is_trivially_relocatable(_Tp)> {};
32+
#else
2533
template <class _Tp, class = void>
2634
struct __libcpp_is_trivially_relocatable : is_trivially_copyable<_Tp> {};
35+
#endif
2736

2837
template <class _Tp>
2938
struct __libcpp_is_trivially_relocatable<_Tp,

0 commit comments

Comments
 (0)