cmd/cgo: cgo-generated header incompatible with latest C++ standards in MSVC #71921
Labels
BugReport
Issues describing a possible bug in the Go implementation.
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.23.3 windows/amd64
Output of
go env
in your module/workspace:What did you do?
I fixed an issue where cgo-generated header files were not compatible with MSVC when using ISO C++ 17 or later. The headers only worked with ISO C++ 14 or earlier due to certain constructs that were deprecated or removed in newer C++ standards.
To reproduce the issue:
What did you see happen?
When compiling the cgo-generated header file in an MSVC project with ISO C++ 17 or later, the compiler produced errors due to the use of constructs that are no longer valid in newer C++ standards.
Example error messages:
What did you expect to see?
I expected the cgo-generated header file to be compatible with MSVC regardless of the C++ standard version being used. It should compile without errors in projects using ISO C++ 17, C++ 20, and later, just as it does with ISO C++ 14 or earlier.
The current output is incorrect because it prevents projects that use newer C++ standards from integrating with cgo-generated code. This issue limits compatibility and forces users to downgrade their C++ standard or modify the generated header manually, which is not an ideal solution. The header should be generated in a way that ensures compatibility with modern C++ versions.
The text was updated successfully, but these errors were encountered: