Skip to content

Commit f1640d0

Browse files
committed
Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5
std::is_trivially_constructible<T> is equivalent to std::is_trivially_default_constructible<T> std::has_trivial_default_constructor<T> is the GCC < 5 name for std::is_trivially_default_constructible<T> std::is_trivial was also used when compiling with clang, due to clang's use of __GNUC__. Test __clang__ to target the intended implementations.
1 parent 271b379 commit f1640d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/compat.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
// GCC 4.8 is missing some C++11 type_traits,
1616
// https://www.gnu.org/software/gcc/gcc-5/changes.html
17-
#if defined(__GNUC__) && __GNUC__ < 5
18-
#define IS_TRIVIALLY_CONSTRUCTIBLE std::is_trivial
17+
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
18+
#define IS_TRIVIALLY_CONSTRUCTIBLE std::has_trivial_default_constructor
1919
#else
20-
#define IS_TRIVIALLY_CONSTRUCTIBLE std::is_trivially_constructible
20+
#define IS_TRIVIALLY_CONSTRUCTIBLE std::is_trivially_default_constructible
2121
#endif
2222

2323
#ifdef WIN32

0 commit comments

Comments
 (0)