Skip to content

fix: handle MSVC warning C4866: compiler may not enforce left-to-right evaluation order #5641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2025

Conversation

XuehaiPan
Copy link
Contributor

@XuehaiPan XuehaiPan commented May 5, 2025

Description

Original error: https://github.com/metaopt/optree/actions/runs/14840166206/job/41660965730?pr=214#step:10:981

Same background (ChatGPT): https://chatgpt.com/share/681d0822-ce30-8008-89a9-74568143f1ee

Copy of error (so search engines pick this up in the future):

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(1395,5): warning MSB8012: TargetPath(C:\Users\RUNNER~1\AppData\Local\Temp\tmpxvs51ag7.build-lib\optree\_C.cp39-win_amd64.pyd) does not match the Linker's OutputFile property value (C:\Users\RUNNER~1\AppData\Local\Temp\tmpxvs51ag7.build-lib\optree\_C.cp39-win_amd64.pyd). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]
       Creating library C:/Users/RUNNER~1/AppData/Local/Temp/tmpat300luf.build-temp/Release/_C.lib and object C:/Users/RUNNER~1/AppData/Local/Temp/tmpat300luf.build-temp/Release/_C.exp
    Generating code
  C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-cdc2qymv\overlay\Lib\site-packages\pybind11\include\pybind11\detail\function_record_pyobject.h(191): error C2220: the following warning is treated as an error [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]
  C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-cdc2qymv\overlay\Lib\site-packages\pybind11\include\pybind11\detail\function_record_pyobject.h(191): error C2220: the following warning is treated as an error [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]
  C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-cdc2qymv\overlay\Lib\site-packages\pybind11\include\pybind11\detail\function_record_pyobject.h(191): error C2220: the following warning is treated as an error [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]
  C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-cdc2qymv\overlay\Lib\site-packages\pybind11\include\pybind11\detail\function_record_pyobject.h(191): warning C4866: compiler may not enforce left-to-right evaluation order for call to 'pybind11::detail::object_api<pybind11::handle>::operator[]' [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]

Suggested changelog entry:

@XuehaiPan XuehaiPan force-pushed the msvc-C4866-warning branch 2 times, most recently from 2efbea6 to 2268f7e Compare May 5, 2025 17:03
@XuehaiPan XuehaiPan force-pushed the msvc-C4866-warning branch from 2268f7e to e29b35b Compare May 5, 2025 17:06
@henryiii henryiii merged commit 002c05b into pybind:master May 7, 2025
65 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label May 7, 2025
@XuehaiPan XuehaiPan deleted the msvc-C4866-warning branch May 8, 2025 14:42
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label May 8, 2025
b-pass pushed a commit to b-pass/pybind11 that referenced this pull request May 9, 2025
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.

3 participants