mirror of https://github.com/golang/go.git
cmd/cgo: generated headers are incompatible with the latest C++ standards in MSVC
The current cgo-generated headers are not compatible with MSVC when using ISO C++ 17 or later. These headers rely on constructs that are deprecated or removed in newer C++ standards, leading to compilation errors. This issue affects projects using modern C++ versions and requires either downgrading the C++ standard or manually modifying the generated headers. Fixes #71921
This commit is contained in:
parent
37e9c5eaba
commit
fcf12e5a22
|
|
@ -1991,10 +1991,16 @@ typedef size_t GoUintptr;
|
|||
typedef float GoFloat32;
|
||||
typedef double GoFloat64;
|
||||
#ifdef _MSC_VER
|
||||
#if !defined(__cplusplus) || _MSVC_LANG <= 201402L
|
||||
#include <complex.h>
|
||||
typedef _Fcomplex GoComplex64;
|
||||
typedef _Dcomplex GoComplex128;
|
||||
#else
|
||||
#include <complex>
|
||||
typedef std::complex<float> GoComplex64;
|
||||
typedef std::complex<double> GoComplex128;
|
||||
#endif
|
||||
#else
|
||||
typedef float _Complex GoComplex64;
|
||||
typedef double _Complex GoComplex128;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue