Skip to content

Commit a3bdd9d

Browse files
fix: Fixes compilation failure with MSVC 17.12 (v14.44) and C++20: '_BACKUP_ITERATOR_DEBUG_LEVEL' undeclared when including span header from STL.
1 parent d36f5dd commit a3bdd9d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

include/pybind11/pybind11.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
*/
1010

1111
#pragma once
12+
13+
// See Issue #5956. This fixes compilation failure with MSVC 17.12 (v14.44) and C++20: '_BACKUP_ITERATOR_DEBUG_LEVEL' undeclared when including span header from STL.
14+
#if defined(_MSC_VER)
15+
#ifndef _BACKUP_ITERATOR_DEBUG_LEVEL
16+
#define _BACKUP_ITERATOR_DEBUG_LEVEL 0
17+
#endif
18+
#endif
19+
1220
#include "detail/class.h"
1321
#include "detail/dynamic_raw_ptr_cast_if_possible.h"
1422
#include "detail/exception_translation.h"

0 commit comments

Comments
 (0)