Skip to content

Conversation

@franzpoeschel
Copy link
Contributor

Description

This PR fixes/works around an internal compiler error triggered by MSVC 19.16 in our CI when trying to upgrade to pybind11 v3.0.1:

_deps\fetchedpybind11-src\include\pybind11\pybind11.h(3008): fatal error C1001: An internal error has occurred in the compiler. [C:\projects\openpmd-api\build\openPMD.py.vcxproj]
  (compiler file 'd:\agent\_work\8\s\src\vctools\compiler\utc\src\p2\main.c', line 187)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  Please choose the Technical Support command on the Visual C++
   Help menu, or open the Technical Support help file for more information

With git-bisect, I found this commit as the first failing commit. More precisely, the compiler crash is caused by this single line:

new (capture::from_data(rec->data)) capture{std::forward<Func>(f)};

This PR now raises the minimum MSVC version with support for std::launder to 19.20, thus excluding also 19.14, 19.15 and 19.16. This locally fixes the error for me.

Suggested changelog entry:

Block MSVC up to 19.16 from use of std::launder due to internal compiler errors

Other

This PR is for the master branch, upon which I cannot test its effect since our project does not seem to compile against the current master branch: _deps/fetchedpybind11-src/include/pybind11/pybind11.h:2462:25: error: static assertion failed: def_property family does not currently support keep_alive. Use a py::cpp_function instead..
Should I additionally submit a PR for v3.0?

Versions 19.4, 19.5 and 19.6 now also excluded. Error seen with 19.6, error triggered by this commit:
pybind@57b9a0a

_deps\fetchedpybind11-src\include\pybind11\pybind11.h(3008): fatal error C1001: An internal error has occurred in the compiler. [C:\projects\openpmd-api\build\openPMD.py.vcxproj]
  (compiler file 'd:\agent\_work\8\s\src\vctools\compiler\utc\src\p2\main.c', line 187)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  Please choose the Technical Support command on the Visual C++
   Help menu, or open the Technical Support help file for more information
Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that should be fine, but could you please add // See PR #5968 to the end of the line? If std::launder causes trouble again, that'll make it much easier for others to discover this PR and to get the full context.

@rwgk
Copy link
Collaborator

rwgk commented Jan 21, 2026

I think that should be fine, but could you please add // See PR #5968 to the end of the line? If std::launder causes trouble again, that'll make it much easier for others to discover this PR and to get the full context.

I just had a minute to quickly do this. I'll merge when I see that the CI is done.

@rwgk rwgk merged commit 5a6edc9 into pybind:master Jan 21, 2026
87 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jan 21, 2026
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Jan 21, 2026
@franzpoeschel
Copy link
Contributor Author

Thank you!

@franzpoeschel
Copy link
Contributor Author

Should I additionally submit a PR for the v3.0 branch for an eventual 3.0.2 release?

@rwgk
Copy link
Collaborator

rwgk commented Jan 21, 2026

Should I additionally submit a PR for the v3.0 branch for an eventual 3.0.2 release?

No need, thanks. We'll just merge the current master into the v3.0 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants