Skip to content

Commit 95ff3d2

Browse files
committed
Try another workaround for __has_builtin-related breakages (https://github.com/pybind/pybind11/runs/7430720321).
1 parent 6182137 commit 95ff3d2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

include/pybind11/detail/descr.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ PYBIND11_NAMESPACE_BEGIN(detail)
4242
// (line numbers vary between translation units).
4343
#if defined(PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD_IF_AVAILABLE) \
4444
&& !defined(PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD) && defined(PYBIND11_CPP17) \
45-
&& !defined(__INTEL_COMPILER) \
46-
&& ((defined(_MSC_VER) && _MSC_VER >= 1920) \
47-
|| (defined(__has_builtin) && __has_builtin(__builtin_FILE) \
48-
&& __has_builtin(__builtin_LINE)))
49-
# define PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD
45+
&& !defined(__INTEL_COMPILER) && (!defined(_MSC_VER) || _MSC_VER >= 1920) \
46+
&& defined(__has_builtin)
47+
// This needs to be a nested #if to not upset older compilers.
48+
# if __has_builtin(__builtin_FILE) && __has_builtin(__builtin_LINE)
49+
# define PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD
50+
# endif
5051
#endif
5152

5253
#ifdef PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD

0 commit comments

Comments
 (0)