File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
libcxx/include/__type_traits Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -28,13 +28,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
28
28
29
29
template <class _Tp >
30
30
struct __libcpp_datasizeof {
31
- #if __has_cpp_attribute(__no_unique_address__)
31
+ #if __has_extension(datasizeof)
32
+ static const size_t value = __datasizeof(_Tp);
33
+ #else
34
+ // NOLINTNEXTLINE(readability-redundant-preprocessor) This is https://llvm.org/PR64825
35
+ # if __has_cpp_attribute(__no_unique_address__)
32
36
template <class = char >
33
37
struct _FirstPaddingByte {
34
38
[[__no_unique_address__]] _Tp __v_;
35
39
char __first_padding_byte_;
36
40
};
37
- #else
41
+ # else
38
42
template <bool = __libcpp_is_final<_Tp>::value || !is_class<_Tp>::value>
39
43
struct _FirstPaddingByte : _Tp {
40
44
char __first_padding_byte_;
@@ -45,14 +49,15 @@ struct __libcpp_datasizeof {
45
49
_Tp __v_;
46
50
char __first_padding_byte_;
47
51
};
48
- #endif
52
+ # endif // __has_cpp_attribute(__no_unique_address__)
49
53
50
54
// _FirstPaddingByte<> is sometimes non-standard layout. Using `offsetof` is UB in that case, but GCC and Clang allow
51
55
// the use as an extension.
52
56
_LIBCPP_DIAGNOSTIC_PUSH
53
57
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Winvalid-offsetof" )
54
58
static const size_t value = offsetof(_FirstPaddingByte<>, __first_padding_byte_);
55
59
_LIBCPP_DIAGNOSTIC_POP
60
+ #endif // __has_extension(datasizeof)
56
61
};
57
62
58
63
_LIBCPP_END_NAMESPACE_STD
You can’t perform that action at this time.
0 commit comments