Skip to content

Commit fe373aa

Browse files
authored
Basic/type_traits: use __has_feature or __has_keyword
That potentially makes these checks more future-proof in case more edge cases are introduced on different platforms.
1 parent 2be8bdd commit fe373aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/swift/Basic/type_traits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct IsTriviallyConstructible {
4949
#if defined(_LIBCPP_VERSION) || SWIFT_COMPILER_IS_MSVC
5050
// libc++ and MSVC implement is_trivially_constructible.
5151
static const bool value = std::is_trivially_constructible<T>::value;
52-
#elif __has_keyword(__is_trivially_constructible)
52+
#elif __has_feature(is_trivially_constructible) || __has_keyword(__is_trivially_constructible)
5353
static const bool value = __is_trivially_constructible(T);
5454
#elif __has_feature(has_trivial_constructor) || __GNUC__ >= 5
5555
static const bool value = __has_trivial_constructor(T);
@@ -63,7 +63,7 @@ struct IsTriviallyDestructible {
6363
#if defined(_LIBCPP_VERSION) || SWIFT_COMPILER_IS_MSVC
6464
// libc++ and MSVC implement is_trivially_destructible.
6565
static const bool value = std::is_trivially_destructible<T>::value;
66-
#elif __has_keyword(__is_trivially_destructible)
66+
#elif __has_feature(is_trivially_destructible) || __has_keyword(__is_trivially_destructible)
6767
static const bool value = __is_trivially_destructible(T);
6868
#elif __has_feature(has_trivial_destructor) || __GNUC__ >= 5
6969
static const bool value = __has_trivial_destructor(T);

0 commit comments

Comments
 (0)